Skip to content

Commit c327b2d

Browse files
authored
QR Code Style Customization (dubinc#3788)
1 parent fbebecb commit c327b2d

9 files changed

Lines changed: 1671 additions & 833 deletions

File tree

apps/web/lib/qr/index.tsx

Lines changed: 304 additions & 28 deletions
Large diffs are not rendered by default.

apps/web/lib/qr/types.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ import qrcodegen from "./codegen";
44
export type Modules = ReturnType<qrcodegen.QrCode["getModules"]>;
55
export type Excavation = { x: number; y: number; w: number; h: number };
66

7+
export type DotStyle = "square" | "rounded" | "extra-rounded";
8+
export type MarkerCenterStyle = "square" | "circle";
9+
export type MarkerBorderStyle = "square" | "rounded-square" | "circle";
10+
11+
export type QRCodeDesign = {
12+
fgColor: string;
13+
hideLogo: boolean;
14+
dotStyle?: DotStyle;
15+
markerCenterStyle?: MarkerCenterStyle;
16+
markerBorderStyle?: MarkerBorderStyle;
17+
markerColor?: string;
18+
};
19+
720
export type ImageSettings = {
821
src: string;
922
height: number;
@@ -23,6 +36,10 @@ export type QRProps = {
2336
style?: CSSProperties;
2437
imageSettings?: ImageSettings;
2538
isOGContext?: boolean;
39+
dotStyle?: DotStyle;
40+
markerCenterStyle?: MarkerCenterStyle;
41+
markerBorderStyle?: MarkerBorderStyle;
42+
markerColor?: string;
2643
};
2744
export type QRPropsCanvas = QRProps &
2845
React.CanvasHTMLAttributes<HTMLCanvasElement>;

0 commit comments

Comments
 (0)