qrdx 0.0.59 → 0.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/core.js +7 -7
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +7 -7
- package/dist/core.mjs.map +1 -1
- package/dist/element.browser.mjs +6 -6
- package/dist/element.browser.mjs.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/dist/qr-code-canvas.js +1 -1
- package/dist/qr-code-canvas.js.map +1 -1
- package/dist/qr-code-canvas.mjs +1 -1
- package/dist/qr-code-canvas.mjs.map +1 -1
- package/dist/schemas.js +1 -1
- package/dist/schemas.js.map +1 -1
- package/dist/schemas.mjs +1 -1
- package/dist/schemas.mjs.map +1 -1
- package/dist/src/corner-dot.d.ts.map +1 -1
- package/dist/src/corner-eye.d.ts.map +1 -1
- package/dist/src/engine.d.ts +1 -1
- package/dist/src/engine.d.ts.map +1 -1
- package/dist/src/looks.d.ts +45 -17
- package/dist/src/looks.d.ts.map +1 -1
- package/dist/src/scan-risk.d.ts.map +1 -1
- package/dist/src/scan-score.d.ts.map +1 -1
- package/dist/src/shapes.d.ts +19 -0
- package/dist/src/shapes.d.ts.map +1 -1
- package/dist/src/utils/oklab.d.ts +16 -0
- package/dist/src/utils/oklab.d.ts.map +1 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/types/constants.d.ts +40 -5
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/corner-dot.d.ts +11 -6
- package/dist/types/corner-dot.d.ts.map +1 -1
- package/dist/types/corner-eye.d.ts +21 -8
- package/dist/types/corner-eye.d.ts.map +1 -1
- package/dist/types/frame-spec.d.ts +1 -1
- package/dist/types/frame.d.ts +2 -2
- package/dist/types/image-pattern.d.ts +3 -3
- package/dist/types/image-pattern.d.ts.map +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +2 -2
- package/dist/types/index.mjs.map +1 -1
- package/dist/types/plain.d.ts +1 -1
- package/dist/types/plain.d.ts.map +1 -1
- package/dist/types/qr.d.ts +96 -46
- package/dist/types/qr.d.ts.map +1 -1
- package/dist/vanilla.browser.mjs +29 -29
- package/dist/vanilla.browser.mjs.map +1 -1
- package/package.json +1 -1
- package/src/corner-dot.tsx +15 -0
- package/src/corner-eye.ts +163 -72
- package/src/engine.ts +4 -0
- package/src/looks.ts +272 -69
- package/src/scan-risk.ts +19 -3
- package/src/scan-score.ts +11 -1
- package/src/shapes.ts +123 -0
- package/src/utils/oklab.ts +93 -0
- package/src/utils.tsx +20 -4
- package/types/constants.ts +59 -3
- package/types/corner-dot.ts +17 -7
- package/types/corner-eye.ts +26 -8
- package/types/image-pattern.ts +11 -4
- package/types/plain.ts +4 -0
- package/types/qr.ts +5 -3
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/** biome-ignore-all lint/style/noMagicNumbers: color math */
|
|
2
|
+
// sRGB to OKLCh and back (Björn Ottosson's OKLab matrices), so a color's
|
|
3
|
+
// lightness can move while its hue stays: the halo's rim (looks.ts
|
|
4
|
+
// fitHaloColor) keeps the hue a person picked and only changes how light
|
|
5
|
+
// it is.
|
|
6
|
+
import type { RGBAColor } from "./parse-color";
|
|
7
|
+
|
|
8
|
+
/** OKLab lightness (0 to 1), chroma and hue (radians). */
|
|
9
|
+
export interface OkLch {
|
|
10
|
+
l: number;
|
|
11
|
+
c: number;
|
|
12
|
+
h: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const toLinear = (channel: number) => {
|
|
16
|
+
const value = channel / 255;
|
|
17
|
+
return value <= 0.040_45 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const toGamma = (value: number) =>
|
|
21
|
+
255 *
|
|
22
|
+
(value <= 0.003_130_8 ? 12.92 * value : 1.055 * value ** (1 / 2.4) - 0.055);
|
|
23
|
+
|
|
24
|
+
/** An sRGB color (channels 0 to 255) in OKLCh; its alpha is dropped. */
|
|
25
|
+
export function rgbToOklch({ r, g, b }: RGBAColor): OkLch {
|
|
26
|
+
const red = toLinear(r);
|
|
27
|
+
const green = toLinear(g);
|
|
28
|
+
const blue = toLinear(b);
|
|
29
|
+
const l = Math.cbrt(
|
|
30
|
+
0.412_221_470_8 * red + 0.536_332_536_3 * green + 0.051_445_992_9 * blue
|
|
31
|
+
);
|
|
32
|
+
const m = Math.cbrt(
|
|
33
|
+
0.211_903_498_2 * red + 0.680_699_545_1 * green + 0.107_396_956_6 * blue
|
|
34
|
+
);
|
|
35
|
+
const s = Math.cbrt(
|
|
36
|
+
0.088_302_461_9 * red + 0.281_718_837_6 * green + 0.629_978_700_5 * blue
|
|
37
|
+
);
|
|
38
|
+
const a = 1.977_998_495_1 * l - 2.428_592_205 * m + 0.450_593_709_9 * s;
|
|
39
|
+
const bb = 0.025_904_037_1 * l + 0.782_771_766_2 * m - 0.808_675_766 * s;
|
|
40
|
+
return {
|
|
41
|
+
l: 0.210_454_255_3 * l + 0.793_617_785 * m - 0.004_072_046_8 * s,
|
|
42
|
+
c: Math.hypot(a, bb),
|
|
43
|
+
h: Math.atan2(bb, a),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Linear sRGB (0 to 1 inside the gamut) of an OKLCh color. */
|
|
48
|
+
function toLinearRgb({ l, c, h }: OkLch): [number, number, number] {
|
|
49
|
+
const a = c * Math.cos(h);
|
|
50
|
+
const b = c * Math.sin(h);
|
|
51
|
+
const long = (l + 0.396_337_777_4 * a + 0.215_803_757_3 * b) ** 3;
|
|
52
|
+
const medium = (l - 0.105_561_345_8 * a - 0.063_854_172_8 * b) ** 3;
|
|
53
|
+
const short = (l - 0.089_484_177_5 * a - 1.291_485_548 * b) ** 3;
|
|
54
|
+
return [
|
|
55
|
+
4.076_741_662_1 * long - 3.307_711_591_3 * medium + 0.230_969_929_2 * short,
|
|
56
|
+
-1.268_438_004_6 * long +
|
|
57
|
+
2.609_757_401_1 * medium -
|
|
58
|
+
0.341_319_396_5 * short,
|
|
59
|
+
-0.004_196_086_3 * long - 0.703_418_614_7 * medium + 1.707_614_701 * short,
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const GAMUT_SLACK = 1e-7;
|
|
64
|
+
const inGamut = (rgb: number[]) =>
|
|
65
|
+
rgb.every((value) => value >= -GAMUT_SLACK && value <= 1 + GAMUT_SLACK);
|
|
66
|
+
|
|
67
|
+
/** Halvings of the chroma when a color is outside sRGB: well past a channel step. */
|
|
68
|
+
const GAMUT_STEPS = 20;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* An OKLCh color as sRGB, channels rounded to whole numbers. Outside sRGB
|
|
72
|
+
* its chroma is reduced until it fits, its lightness and hue kept.
|
|
73
|
+
*/
|
|
74
|
+
export function oklchToRgb(color: OkLch): RGBAColor {
|
|
75
|
+
let linear = toLinearRgb(color);
|
|
76
|
+
if (!inGamut(linear)) {
|
|
77
|
+
let inside = 0;
|
|
78
|
+
let outside = color.c;
|
|
79
|
+
for (let step = 0; step < GAMUT_STEPS; step++) {
|
|
80
|
+
const c = (inside + outside) / 2;
|
|
81
|
+
if (inGamut(toLinearRgb({ ...color, c }))) {
|
|
82
|
+
inside = c;
|
|
83
|
+
} else {
|
|
84
|
+
outside = c;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
linear = toLinearRgb({ ...color, c: inside });
|
|
88
|
+
}
|
|
89
|
+
const [r = 0, g = 0, b = 0] = linear.map((value) =>
|
|
90
|
+
Math.round(toGamma(Math.min(1, Math.max(0, value))))
|
|
91
|
+
);
|
|
92
|
+
return { r, g, b, a: 1 };
|
|
93
|
+
}
|
package/src/utils.tsx
CHANGED
|
@@ -19,7 +19,13 @@ import {
|
|
|
19
19
|
isImagePaint,
|
|
20
20
|
normalizeColorConfig,
|
|
21
21
|
} from "../types/color-helpers";
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
AUTO_LEVEL_LOGO_COVERAGE,
|
|
24
|
+
WITHDRAWN_BODY_PATTERNS,
|
|
25
|
+
WITHDRAWN_CORNER_EYE_DOT_PATTERNS,
|
|
26
|
+
WITHDRAWN_CORNER_EYE_PATTERNS,
|
|
27
|
+
withdrawnFallback,
|
|
28
|
+
} from "../types/constants";
|
|
23
29
|
import type { EyePosition, QRCodeShape } from "../types/qr";
|
|
24
30
|
import { getQRArtEyeColors, isQRArtActive, renderQRArt } from "./art";
|
|
25
31
|
import {
|
|
@@ -954,9 +960,9 @@ export function createQRCodeTree(props: QRSVGOptions): QRNode {
|
|
|
954
960
|
fgColor = DEFAULT_FGCOLOR,
|
|
955
961
|
eyeColor,
|
|
956
962
|
dotColor,
|
|
957
|
-
bodyPattern = "circle",
|
|
958
|
-
cornerEyePattern = "gear",
|
|
959
|
-
cornerEyeDotPattern = "circle",
|
|
963
|
+
bodyPattern: requestedBody = "circle",
|
|
964
|
+
cornerEyePattern: requestedEye = "gear",
|
|
965
|
+
cornerEyeDotPattern: requestedDot = "circle",
|
|
960
966
|
margin = DEFAULT_MARGIN,
|
|
961
967
|
isOGContext = false,
|
|
962
968
|
imageSettings: requestedImageSettings,
|
|
@@ -979,6 +985,16 @@ export function createQRCodeTree(props: QRSVGOptions): QRNode {
|
|
|
979
985
|
partMarkers,
|
|
980
986
|
...otherProps
|
|
981
987
|
} = props;
|
|
988
|
+
// A shape withdrawn before release draws as the one it maps to
|
|
989
|
+
const bodyPattern = withdrawnFallback(WITHDRAWN_BODY_PATTERNS, requestedBody);
|
|
990
|
+
const cornerEyePattern = withdrawnFallback(
|
|
991
|
+
WITHDRAWN_CORNER_EYE_PATTERNS,
|
|
992
|
+
requestedEye
|
|
993
|
+
);
|
|
994
|
+
const cornerEyeDotPattern = withdrawnFallback(
|
|
995
|
+
WITHDRAWN_CORNER_EYE_DOT_PATTERNS,
|
|
996
|
+
requestedDot
|
|
997
|
+
);
|
|
982
998
|
// A logo no bigger than the code can repair (logo-budget.ts)
|
|
983
999
|
const imageSettings = capImageSettings(
|
|
984
1000
|
{ value, size, margin, level, shape, autoLevel, isOGContext },
|
package/types/constants.ts
CHANGED
|
@@ -55,6 +55,8 @@ export const CORNER_EYE_DOT_PATTERNS = [
|
|
|
55
55
|
"extra-rounded",
|
|
56
56
|
"leaf-reverse",
|
|
57
57
|
"drop-reverse",
|
|
58
|
+
// Added after 0.0.57
|
|
59
|
+
"cushion",
|
|
58
60
|
] as const;
|
|
59
61
|
|
|
60
62
|
/**
|
|
@@ -92,6 +94,12 @@ export const CORNER_EYE_PATTERNS = [
|
|
|
92
94
|
"shield",
|
|
93
95
|
"petal",
|
|
94
96
|
"leaf-reverse",
|
|
97
|
+
// Added after 0.0.57
|
|
98
|
+
"porthole",
|
|
99
|
+
"notch",
|
|
100
|
+
"plus",
|
|
101
|
+
"bud",
|
|
102
|
+
"bowl",
|
|
95
103
|
] as const;
|
|
96
104
|
|
|
97
105
|
/**
|
|
@@ -130,6 +138,52 @@ export const BODY_PATTERN = [
|
|
|
130
138
|
"octagon",
|
|
131
139
|
] as const;
|
|
132
140
|
|
|
141
|
+
// ── Withdrawn before release ───────────────────────────────────────────────
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Shapes that staging builds offered after 0.0.57 and that were withdrawn
|
|
145
|
+
* before any release: they missed strict decoders in sharp renders, or
|
|
146
|
+
* looked like a shape the catalogue already has. A saved design, link or
|
|
147
|
+
* API call that still names one draws the shape it maps to.
|
|
148
|
+
*/
|
|
149
|
+
export const WITHDRAWN_BODY_PATTERNS = {
|
|
150
|
+
x: "plus",
|
|
151
|
+
pebble: "rounded",
|
|
152
|
+
flower: "circle",
|
|
153
|
+
beads: "circle",
|
|
154
|
+
bubble: "circle",
|
|
155
|
+
chain: "circle",
|
|
156
|
+
petal: "leaf",
|
|
157
|
+
drop: "rounded",
|
|
158
|
+
squircle: "rounded",
|
|
159
|
+
} as const satisfies Record<string, (typeof BODY_PATTERN)[number]>;
|
|
160
|
+
|
|
161
|
+
export const WITHDRAWN_CORNER_EYE_PATTERNS = {
|
|
162
|
+
pebble: "squircle",
|
|
163
|
+
tag: "rounded",
|
|
164
|
+
crest: "shield",
|
|
165
|
+
doodle: "squircle",
|
|
166
|
+
stamp: "notch",
|
|
167
|
+
} as const satisfies Record<string, (typeof CORNER_EYE_PATTERNS)[number]>;
|
|
168
|
+
|
|
169
|
+
export const WITHDRAWN_CORNER_EYE_DOT_PATTERNS = {
|
|
170
|
+
bevel: "square",
|
|
171
|
+
notch: "square",
|
|
172
|
+
} as const satisfies Record<string, (typeof CORNER_EYE_DOT_PATTERNS)[number]>;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The shape to draw for `value`: its replacement when it was withdrawn,
|
|
176
|
+
* otherwise `value` itself (anything else, valid or not, passes through).
|
|
177
|
+
*/
|
|
178
|
+
export function withdrawnFallback<T>(
|
|
179
|
+
withdrawn: Readonly<Record<string, string>>,
|
|
180
|
+
value: T
|
|
181
|
+
): T {
|
|
182
|
+
return typeof value === "string" && Object.hasOwn(withdrawn, value)
|
|
183
|
+
? (withdrawn[value] as T)
|
|
184
|
+
: value;
|
|
185
|
+
}
|
|
186
|
+
|
|
133
187
|
// ── Frames (frame.ts) ──────────────────────────────────────────────────────
|
|
134
188
|
|
|
135
189
|
export const FRAME_STYLES = [
|
|
@@ -236,9 +290,11 @@ export const BG_RADIUS_QUIET_RATIO = 2;
|
|
|
236
290
|
/**
|
|
237
291
|
* A halo is a light rim around every dark module and eye (`halo`); its
|
|
238
292
|
* width is in modules. It is a look, not a quiet zone: decoders still need
|
|
239
|
-
* `margin`. It is drawn only on an opaque background
|
|
240
|
-
* light as HALO_LIGHT_MIN and no
|
|
241
|
-
*
|
|
293
|
+
* `margin`. It is drawn only on an opaque background at least as light as
|
|
294
|
+
* HALO_LIGHT_MIN, in a rim at least as light as HALO_LIGHT_MIN and no
|
|
295
|
+
* lighter than the background: any other rim color is drawn in the
|
|
296
|
+
* closest one inside that range (looks.ts fitHaloColor). The default rim
|
|
297
|
+
* is a light grey, so it shows on white.
|
|
242
298
|
*/
|
|
243
299
|
export const HALO_WIDTH_MIN = 0.1;
|
|
244
300
|
export const HALO_WIDTH_MAX = 0.5;
|
package/types/corner-dot.ts
CHANGED
|
@@ -2,22 +2,32 @@ import { z } from "zod";
|
|
|
2
2
|
import {
|
|
3
3
|
CORNER_EYE_DOT_PATTERNS,
|
|
4
4
|
RETIRED_CORNER_EYE_DOT_PATTERNS,
|
|
5
|
+
WITHDRAWN_CORNER_EYE_DOT_PATTERNS,
|
|
6
|
+
withdrawnFallback,
|
|
5
7
|
} from "./constants";
|
|
6
8
|
|
|
7
9
|
export {
|
|
8
10
|
CORNER_EYE_DOT_PATTERNS,
|
|
9
11
|
RETIRED_CORNER_EYE_DOT_PATTERNS,
|
|
12
|
+
WITHDRAWN_CORNER_EYE_DOT_PATTERNS,
|
|
10
13
|
} from "./constants";
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const fallback = (value: unknown) =>
|
|
16
|
+
withdrawnFallback(WITHDRAWN_CORNER_EYE_DOT_PATTERNS, value);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Accepts current and retired values, so saved designs still validate; a
|
|
20
|
+
* withdrawn id parses as the shape it maps to.
|
|
21
|
+
*/
|
|
22
|
+
export const cornerEyeDotPatternSchema = z.preprocess(
|
|
23
|
+
fallback,
|
|
24
|
+
z.enum([...CORNER_EYE_DOT_PATTERNS, ...RETIRED_CORNER_EYE_DOT_PATTERNS])
|
|
25
|
+
);
|
|
17
26
|
|
|
18
27
|
/** Current values only: for anything that offers a choice (UI, AI, MCP). */
|
|
19
|
-
export const pickableCornerEyeDotPatternSchema = z.
|
|
20
|
-
|
|
28
|
+
export const pickableCornerEyeDotPatternSchema = z.preprocess(
|
|
29
|
+
fallback,
|
|
30
|
+
z.enum(CORNER_EYE_DOT_PATTERNS)
|
|
21
31
|
);
|
|
22
32
|
|
|
23
33
|
// Inferred types
|
package/types/corner-eye.ts
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
CORNER_EYE_PATTERNS,
|
|
4
|
+
RETIRED_CORNER_EYE_PATTERNS,
|
|
5
|
+
WITHDRAWN_CORNER_EYE_PATTERNS,
|
|
6
|
+
withdrawnFallback,
|
|
7
|
+
} from "./constants";
|
|
3
8
|
|
|
4
|
-
export {
|
|
9
|
+
export {
|
|
10
|
+
CORNER_EYE_PATTERNS,
|
|
11
|
+
RETIRED_CORNER_EYE_PATTERNS,
|
|
12
|
+
WITHDRAWN_CORNER_EYE_PATTERNS,
|
|
13
|
+
} from "./constants";
|
|
5
14
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
const fallback = (value: unknown) =>
|
|
16
|
+
withdrawnFallback(WITHDRAWN_CORNER_EYE_PATTERNS, value);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Accepts current and retired values, so saved designs still validate; a
|
|
20
|
+
* withdrawn id parses as the shape it maps to.
|
|
21
|
+
*/
|
|
22
|
+
export const cornerEyePatternSchema = z.preprocess(
|
|
23
|
+
fallback,
|
|
24
|
+
z.enum([...CORNER_EYE_PATTERNS, ...RETIRED_CORNER_EYE_PATTERNS])
|
|
25
|
+
);
|
|
11
26
|
|
|
12
27
|
/** Current values only: for anything that offers a choice (UI, AI, MCP). */
|
|
13
|
-
export const pickableCornerEyePatternSchema = z.
|
|
28
|
+
export const pickableCornerEyePatternSchema = z.preprocess(
|
|
29
|
+
fallback,
|
|
30
|
+
z.enum(CORNER_EYE_PATTERNS)
|
|
31
|
+
);
|
|
14
32
|
|
|
15
33
|
// Inferred types
|
|
16
34
|
export type CornerEyePattern = z.infer<typeof cornerEyePatternSchema>;
|
package/types/image-pattern.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
BODY_PATTERN,
|
|
4
|
+
WITHDRAWN_BODY_PATTERNS,
|
|
5
|
+
withdrawnFallback,
|
|
6
|
+
} from "./constants";
|
|
3
7
|
|
|
4
|
-
export { BODY_PATTERN } from "./constants";
|
|
8
|
+
export { BODY_PATTERN, WITHDRAWN_BODY_PATTERNS } from "./constants";
|
|
5
9
|
|
|
6
|
-
// Zod schema
|
|
7
|
-
export const bodyPatternSchema = z.
|
|
10
|
+
// Zod schema: a withdrawn id parses as the shape it maps to
|
|
11
|
+
export const bodyPatternSchema = z.preprocess(
|
|
12
|
+
(value) => withdrawnFallback(WITHDRAWN_BODY_PATTERNS, value),
|
|
13
|
+
z.enum(BODY_PATTERN)
|
|
14
|
+
);
|
|
8
15
|
|
|
9
16
|
// Inferred type
|
|
10
17
|
export type BodyPattern = z.infer<typeof bodyPatternSchema>;
|
package/types/plain.ts
CHANGED
|
@@ -75,6 +75,10 @@ export {
|
|
|
75
75
|
SHADOW_OPACITY_DEFAULT,
|
|
76
76
|
SHADOW_OPACITY_MAX,
|
|
77
77
|
SHADOW_OPACITY_MIN,
|
|
78
|
+
WITHDRAWN_BODY_PATTERNS,
|
|
79
|
+
WITHDRAWN_CORNER_EYE_DOT_PATTERNS,
|
|
80
|
+
WITHDRAWN_CORNER_EYE_PATTERNS,
|
|
81
|
+
withdrawnFallback,
|
|
78
82
|
} from "./constants";
|
|
79
83
|
export type {
|
|
80
84
|
CornerEyeDotPattern,
|
package/types/qr.ts
CHANGED
|
@@ -183,9 +183,11 @@ export const eyeGradientSpanSchema = z.enum(EYE_GRADIENT_SPANS);
|
|
|
183
183
|
* A light rim around every dark module and eye. `width` is in modules
|
|
184
184
|
* (HALO_WIDTH_MIN to HALO_WIDTH_MAX, default HALO_WIDTH_DEFAULT); `color`
|
|
185
185
|
* is a solid color (default HALO_COLOR_DEFAULT, #e5e7eb), drawn opaque
|
|
186
|
-
* (its alpha is dropped). Drawn only on an opaque background
|
|
187
|
-
*
|
|
188
|
-
*
|
|
186
|
+
* (its alpha is dropped). Drawn only on an opaque background at least as
|
|
187
|
+
* light as HALO_LIGHT_MIN (getHaloRisk says why not otherwise). Any color
|
|
188
|
+
* is taken: one decoders read darker than HALO_LIGHT_MIN or lighter than
|
|
189
|
+
* the background is drawn in the closest color between the two
|
|
190
|
+
* (fitHaloColor).
|
|
189
191
|
*/
|
|
190
192
|
export const haloSchema = z.object({
|
|
191
193
|
color: z.string().optional(),
|