@tenphi/glaze 0.0.0-snapshot.651fdbb → 0.0.0-snapshot.6b78fce
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/AGENTS.md +158 -0
- package/README.md +111 -34
- package/dist/index.cjs +3422 -1086
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1075 -138
- package/dist/index.d.mts +1075 -138
- package/dist/index.mjs +3404 -1087
- package/dist/index.mjs.map +1 -1
- package/docs/contrast.mdx +726 -0
- package/docs/exporting.mdx +628 -0
- package/docs/getting-started.mdx +486 -0
- package/docs/methodology.mdx +972 -0
- package/docs/migration.md +286 -275
- package/docs/mixes.mdx +271 -0
- package/docs/okhst.mdx +604 -0
- package/docs/reference/color-definitions.md +498 -0
- package/docs/reference/color-tokens.md +398 -0
- package/docs/reference/configuration.md +456 -0
- package/docs/reference/contrast.md +276 -0
- package/docs/reference/index.md +218 -0
- package/docs/reference/output.md +607 -0
- package/docs/reference/palette.md +395 -0
- package/docs/reference/theme.md +326 -0
- package/docs/reference/utilities.md +532 -0
- package/docs/schemes.mdx +550 -0
- package/docs/shadows-and-glows.mdx +509 -0
- package/package.json +12 -3
- package/docs/api.md +0 -1244
- package/docs/methodology.md +0 -346
- package/docs/okhst.md +0 -216
package/dist/index.d.cts
CHANGED
|
@@ -2,19 +2,84 @@
|
|
|
2
2
|
type LinearRgb = [number, number, number];
|
|
3
3
|
type ContrastPreset = 'AA' | 'AAA' | 'AA-large' | 'AAA-large';
|
|
4
4
|
type MinContrast$1 = number | ContrastPreset;
|
|
5
|
+
/**
|
|
6
|
+
* Named APCA Lc floor presets (APCA Bronze Simple Mode conformance levels),
|
|
7
|
+
* independent of role. Use them anywhere an APCA target is accepted.
|
|
8
|
+
*
|
|
9
|
+
* | Preset | Lc | Use case |
|
|
10
|
+
* | ------------- | --- | ---------------------------------------------------- |
|
|
11
|
+
* | `'preferred'` | 90 | Preferred body / column text |
|
|
12
|
+
* | `'body'` | 75 | Minimum body / column text |
|
|
13
|
+
* | `'content'` | 60 | Readable non-body content (~WCAG AA 4.5:1) |
|
|
14
|
+
* | `'large'` | 45 | Large/bold headlines; fine icons/outlines (~3:1) |
|
|
15
|
+
* | `'non-text'` | 30 | Solid icons/controls; placeholder/disabled text |
|
|
16
|
+
* | `'min'` | 15 | Dividers/decorative; APCA "point of invisibility" |
|
|
17
|
+
*/
|
|
18
|
+
type ApcaPreset = 'preferred' | 'body' | 'content' | 'large' | 'non-text' | 'min';
|
|
19
|
+
declare const APCA_PRESETS: Record<ApcaPreset, number>;
|
|
20
|
+
/**
|
|
21
|
+
* APCA-W3 "Enhanced Level" delta added to a bare APCA target in high-contrast
|
|
22
|
+
* mode when no explicit HC value is provided (analogous to WCAG AAA over AA).
|
|
23
|
+
* Only applied when neither the outer `contrast` pair nor the inner `apca`
|
|
24
|
+
* pair carries an explicit HC entry.
|
|
25
|
+
*/
|
|
26
|
+
declare const APCA_HC_ENHANCEMENT = 15;
|
|
27
|
+
/** Upper bound for an APCA Lc target after HC enhancement. */
|
|
28
|
+
declare const APCA_MAX_LC = 106;
|
|
29
|
+
/**
|
|
30
|
+
* Resolve an APCA target — a raw Lc number (kept as-is) or an `ApcaPreset`
|
|
31
|
+
* keyword mapped to its Lc value. The magnitude is forced non-negative.
|
|
32
|
+
*/
|
|
33
|
+
declare function resolveApcaTarget(value: number | ApcaPreset): number;
|
|
5
34
|
/** Metric + numeric target after resolving a `ContrastSpec` for a mode. */
|
|
6
35
|
interface ResolvedContrast {
|
|
7
36
|
metric: 'wcag' | 'apca';
|
|
8
37
|
/** WCAG ratio (>= 1) or APCA Lc magnitude (0–106). */
|
|
9
38
|
target: number;
|
|
39
|
+
/**
|
|
40
|
+
* APCA argument order: which side the resolved (candidate) color plays
|
|
41
|
+
* against the base. `'fg'` (default) → `apcaContrast(yCandidate, yBase)`;
|
|
42
|
+
* `'bg'` → `apcaContrast(yBase, yCandidate)`. Always `'fg'` for WCAG
|
|
43
|
+
* (symmetric, ignored).
|
|
44
|
+
*/
|
|
45
|
+
polarity?: 'fg' | 'bg';
|
|
10
46
|
}
|
|
11
47
|
declare function resolveMinContrast(value: MinContrast$1): number;
|
|
12
48
|
/**
|
|
13
49
|
* Resolve a `ContrastSpec` (already selected from any outer HC pair) for a
|
|
14
50
|
* given mode into `{ metric, target }`. Handles the inner metric HC pair and
|
|
15
|
-
* preset resolution.
|
|
51
|
+
* preset resolution. `polarity` is passed through to the result for the APCA
|
|
52
|
+
* branch (it controls argument order in the solver); WCAG ignores it.
|
|
53
|
+
*
|
|
54
|
+
* `outerExplicitHC` indicates whether the caller selected this `spec` from an
|
|
55
|
+
* explicit high-contrast entry of the outer `contrast` pair. Together with the
|
|
56
|
+
* inner metric pair, it decides whether the HC auto-enhancement fires:
|
|
57
|
+
* - APCA: +15 Lc "Enhanced Level" boost when neither level is explicit.
|
|
58
|
+
* - WCAG: AA → AAA / AA-large → AAA-large promotion (SC 1.4.3 → 1.4.6) when
|
|
59
|
+
* neither level is explicit. AAA-family presets and bare numbers are left
|
|
60
|
+
* unchanged (AAA is the top WCAG tier).
|
|
61
|
+
* Defaults to `false` (correct for direct callers, which pass a single
|
|
62
|
+
* selected spec rather than an outer pair).
|
|
16
63
|
*/
|
|
17
|
-
declare function resolveContrastForMode(spec: ContrastSpec, isHighContrast: boolean): ResolvedContrast;
|
|
64
|
+
declare function resolveContrastForMode(spec: ContrastSpec, isHighContrast: boolean, polarity?: 'fg' | 'bg', outerExplicitHC?: boolean): ResolvedContrast;
|
|
65
|
+
/**
|
|
66
|
+
* Resolve a `contrast` spec — including its outer `[normal, highContrast]`
|
|
67
|
+
* pair — at a manual contrast `level` (0–100), by resolving both ends and
|
|
68
|
+
* interpolating the numeric target.
|
|
69
|
+
*
|
|
70
|
+
* Level 0 / 100 delegate verbatim to {@link resolveContrastForMode}, so the
|
|
71
|
+
* endpoints are bit-identical to classic normal / high-contrast resolution.
|
|
72
|
+
* Resolving each end fully first also means every rule that governs the
|
|
73
|
+
* escalation still applies at both ends for free: preset mapping, the
|
|
74
|
+
* `APCA_MAX_LC` clamp, and the explicit-HC suppression that cancels the
|
|
75
|
+
* `AA → AAA` promotion and the `+15 Lc` enhancement.
|
|
76
|
+
*
|
|
77
|
+
* Throws when the two ends measure in different metrics — a WCAG ratio and an
|
|
78
|
+
* APCA Lc live on different scales, so there is no target between them. Such a
|
|
79
|
+
* pair is rejected at authoring time by `validateColorDefs`; this is the guard
|
|
80
|
+
* for direct callers.
|
|
81
|
+
*/
|
|
82
|
+
declare function resolveContrastForLevel(spec: HCPair<ContrastSpec>, level: number, polarity?: 'fg' | 'bg'): ResolvedContrast;
|
|
18
83
|
/**
|
|
19
84
|
* APCA lightness contrast (Lc), signed: positive for dark text on light bg,
|
|
20
85
|
* negative for light text on dark bg. Inputs are screen luminances (0–1).
|
|
@@ -37,10 +102,31 @@ interface FindToneForContrastOptions {
|
|
|
37
102
|
epsilon?: number;
|
|
38
103
|
/** Maximum binary-search iterations per branch. Default: 18. */
|
|
39
104
|
maxIterations?: number;
|
|
40
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* Preferred search direction before auto-flip is considered. Default: the
|
|
107
|
+
* side whose bound scores higher (the only open side when `preferredTone`
|
|
108
|
+
* sits on a bound); a tie within float noise starts `'darker'`.
|
|
109
|
+
*/
|
|
41
110
|
initialDirection?: 'lighter' | 'darker';
|
|
42
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* Also search the opposite direction. Default: false. When both directions
|
|
113
|
+
* meet the target, the result nearer `preferredTone` wins; a gap within
|
|
114
|
+
* twice the search resolution is a tie and keeps `initialDirection`.
|
|
115
|
+
*/
|
|
43
116
|
flip?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* When `flip` is on and *both* directions meet the target, keep
|
|
119
|
+
* `initialDirection` instead of taking whichever result lands nearer the
|
|
120
|
+
* preferred tone. Default: false (nearest wins).
|
|
121
|
+
*
|
|
122
|
+
* The nearest-wins tie-break is unstable along a ramp of targets: which side
|
|
123
|
+
* is nearer shifts as the target grows, so a color can swap sides between two
|
|
124
|
+
* adjacent targets. Set this when a caller needs the side to be a property of
|
|
125
|
+
* the color rather than of the target — the manual contrast level does. The
|
|
126
|
+
* flip itself is unaffected: an initial direction that cannot reach the
|
|
127
|
+
* target still falls back to the opposite side.
|
|
128
|
+
*/
|
|
129
|
+
preferInitial?: boolean;
|
|
44
130
|
/** Use the hue-independent "safe" chroma boundary. Default: false. */
|
|
45
131
|
pastel?: boolean;
|
|
46
132
|
}
|
|
@@ -51,26 +137,37 @@ interface FindToneForContrastResult {
|
|
|
51
137
|
contrast: number;
|
|
52
138
|
/** Whether the target was reached. */
|
|
53
139
|
met: boolean;
|
|
54
|
-
/**
|
|
140
|
+
/**
|
|
141
|
+
* The side the result was found on. The two sides meet at `preferredTone`,
|
|
142
|
+
* so a met result sits on that side of the base too. `'preferred'` when the
|
|
143
|
+
* result is `preferredTone` itself: it already cleared the overshooting
|
|
144
|
+
* search target, or no searched side met the floor while it clears the bare
|
|
145
|
+
* target (or there was no room to search).
|
|
146
|
+
*/
|
|
55
147
|
branch: 'lighter' | 'darker' | 'preferred';
|
|
56
148
|
/** Whether the result auto-flipped to the opposite direction. */
|
|
57
149
|
flipped?: boolean;
|
|
58
150
|
}
|
|
59
151
|
/**
|
|
60
152
|
* Find the tone that satisfies a contrast floor against a base color,
|
|
61
|
-
* staying as close to `preferredTone` as possible.
|
|
153
|
+
* staying as close to `preferredTone` as possible. A searched result keeps the
|
|
154
|
+
* overshoot (1% for WCAG, 0.5 Lc for APCA). When no searched side reaches the
|
|
155
|
+
* floor, the result pins to the initial direction's extreme, unmet — unless
|
|
156
|
+
* `preferredTone` itself clears the bare target, which is then kept as met.
|
|
62
157
|
*/
|
|
63
158
|
declare function findToneForContrast(options: FindToneForContrastOptions): FindToneForContrastResult;
|
|
64
159
|
interface FindValueForMixContrastOptions {
|
|
65
160
|
/** Preferred mix parameter (0–1). */
|
|
66
161
|
preferredValue: number;
|
|
67
|
-
/** Base color as linear sRGB. */
|
|
162
|
+
/** Base color as linear sRGB — the color the mix is measured against. */
|
|
68
163
|
baseLinearRgb: LinearRgb;
|
|
69
|
-
/** Target color as linear sRGB. */
|
|
70
|
-
targetLinearRgb: LinearRgb;
|
|
71
164
|
/** Resolved contrast floor (metric + target). */
|
|
72
165
|
contrast: ResolvedContrast;
|
|
73
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* Luminance of the mixed color at parameter t, in the metric's basis
|
|
168
|
+
* ({@link metricLuminance}). This closure is the only view the solver has of
|
|
169
|
+
* the mix's target color, blend, and color space.
|
|
170
|
+
*/
|
|
74
171
|
luminanceAtValue: (t: number) => number;
|
|
75
172
|
/** Convergence threshold. Default: 1e-4. */
|
|
76
173
|
epsilon?: number;
|
|
@@ -88,6 +185,9 @@ interface FindValueForMixContrastResult {
|
|
|
88
185
|
/**
|
|
89
186
|
* Find the mix parameter (ratio or opacity) that satisfies a contrast floor
|
|
90
187
|
* against a base color, staying as close to `preferredValue` as possible.
|
|
188
|
+
* Misses pin to the initial direction's end like the tone solver, and a
|
|
189
|
+
* `preferredValue` that clears the bare target is kept as met when no searched
|
|
190
|
+
* side reaches the floor (a value of 1 has no room toward the target).
|
|
91
191
|
*/
|
|
92
192
|
declare function findValueForMixContrast(options: FindValueForMixContrastOptions): FindValueForMixContrastResult;
|
|
93
193
|
//#endregion
|
|
@@ -101,17 +201,30 @@ type MinContrast = number | ContrastPreset;
|
|
|
101
201
|
*
|
|
102
202
|
* - `number` / `ContrastPreset`: a WCAG ratio (bare form).
|
|
103
203
|
* - `{ wcag }`: WCAG ratio or preset, optionally an HC pair.
|
|
104
|
-
* - `{ apca }`: APCA Lc target (absolute value), optionally an HC pair.
|
|
204
|
+
* - `{ apca }`: APCA Lc target (absolute value or preset), optionally an HC pair.
|
|
105
205
|
*
|
|
106
206
|
* The `[normal, highContrast]` pair may live at the outer level
|
|
107
207
|
* (`[4.5, 7]`, `[{ wcag: 4.5 }, { wcag: 7 }]`) or inside the metric
|
|
108
|
-
* (`{ wcag: [4.5, 7] }`, `{ apca: [45, 60] }`).
|
|
208
|
+
* (`{ wcag: [4.5, 7] }`, `{ apca: [45, 60] }`, `{ apca: ['content', 'body'] }`).
|
|
109
209
|
*/
|
|
110
210
|
type ContrastSpec = number | ContrastPreset | {
|
|
111
211
|
wcag: HCPair<number | ContrastPreset>;
|
|
112
212
|
} | {
|
|
113
|
-
apca: HCPair<number>;
|
|
213
|
+
apca: HCPair<number | ApcaPreset>;
|
|
114
214
|
};
|
|
215
|
+
/**
|
|
216
|
+
* The semantic role a color plays against its base, used to fix APCA contrast
|
|
217
|
+
* polarity (which side is the foreground vs the background). WCAG is
|
|
218
|
+
* symmetric, so role never changes WCAG results.
|
|
219
|
+
*/
|
|
220
|
+
type Role = 'text' | 'surface' | 'border';
|
|
221
|
+
/**
|
|
222
|
+
* Any string accepted as a `role`. Canonical values plus aliases normalized by
|
|
223
|
+
* `normalizeRole` (see `roles.ts`): `surface` (bg/background/fill/canvas/
|
|
224
|
+
* paper/layer), `text` (fg/foreground/content/ink/label/stroke), `border`
|
|
225
|
+
* (divider/outline/separator/hairline/rule).
|
|
226
|
+
*/
|
|
227
|
+
type RoleInput = Role | 'bg' | 'background' | 'fill' | 'canvas' | 'paper' | 'layer' | 'fg' | 'foreground' | 'content' | 'ink' | 'label' | 'stroke' | 'divider' | 'outline' | 'separator' | 'hairline' | 'rule';
|
|
115
228
|
type AdaptationMode = 'auto' | 'fixed' | 'static';
|
|
116
229
|
/** A signed relative offset string, e.g. '+20' or '-15.5'. */
|
|
117
230
|
type RelativeValue = `+${number}` | `-${number}`;
|
|
@@ -132,7 +245,7 @@ type ExtremeValue = 'max' | 'min';
|
|
|
132
245
|
*/
|
|
133
246
|
type ToneValue = number | RelativeValue | ExtremeValue;
|
|
134
247
|
/** Color format for output. */
|
|
135
|
-
type GlazeColorFormat = 'okhsl' | 'rgb' | 'hsl' | 'oklch';
|
|
248
|
+
type GlazeColorFormat = 'okhsl' | 'okhst' | 'rgb' | 'hsl' | 'oklch';
|
|
136
249
|
/**
|
|
137
250
|
* Controls which scheme variants are generated in the export.
|
|
138
251
|
* Light is always included (it's the default).
|
|
@@ -140,7 +253,15 @@ type GlazeColorFormat = 'okhsl' | 'rgb' | 'hsl' | 'oklch';
|
|
|
140
253
|
interface GlazeOutputModes {
|
|
141
254
|
/** Include dark scheme variants. Default: true. */
|
|
142
255
|
dark?: boolean;
|
|
143
|
-
/**
|
|
256
|
+
/**
|
|
257
|
+
* Include high-contrast variants (both light-HC and dark-HC). Default: false.
|
|
258
|
+
*
|
|
259
|
+
* Independent of `contrastLevel` — the level positions the normal variants
|
|
260
|
+
* while these stay the true high-contrast resolution, so the two compose. The
|
|
261
|
+
* exception is a global level of 100, where the normal variants already *are*
|
|
262
|
+
* the high-contrast ones: the tier would duplicate them and is dropped.
|
|
263
|
+
* @see GlazeConfig.contrastLevel
|
|
264
|
+
*/
|
|
144
265
|
highContrast?: boolean;
|
|
145
266
|
}
|
|
146
267
|
/** Hex color string for DX hints. Runtime validation in `parseHex()`. */
|
|
@@ -174,13 +295,43 @@ interface OklchColor {
|
|
|
174
295
|
}
|
|
175
296
|
interface RegularColorDef {
|
|
176
297
|
/**
|
|
177
|
-
*
|
|
298
|
+
* Seed this color from a literal color instead of from the theme.
|
|
299
|
+
*
|
|
300
|
+
* Accepts the same values as `glaze.color()` — hex, `rgb()`, `hsl()`,
|
|
301
|
+
* `okhsl()`, `okhst()`, `oklch()`, or a value object. It supplies three
|
|
302
|
+
* things at once: `hue`, `tone`, and — unlike every other color in a theme —
|
|
303
|
+
* an **absolute saturation** rather than a factor of the seed. That last
|
|
304
|
+
* part is the point: a color can now be more saturated than its theme, so
|
|
305
|
+
* honoring a brand color no longer means re-seeding the whole theme to reach
|
|
306
|
+
* it.
|
|
307
|
+
*
|
|
308
|
+
* The **light, normal-contrast** variant reproduces the value exactly
|
|
309
|
+
* (a local `lightTone: false`, matching the value-shorthand form of
|
|
310
|
+
* `glaze.color()`). Dark and high-contrast variants adapt as usual — they
|
|
311
|
+
* are where readability outranks fidelity, and a color pinned across every
|
|
312
|
+
* scheme would defeat both. A `contrast` floor still applies everywhere and
|
|
313
|
+
* still only moves the color when the authored value misses it.
|
|
314
|
+
*
|
|
315
|
+
* Sibling fields override what the value supplied, so
|
|
316
|
+
* `{ from: '#2F5BFF', hue: 300 }` keeps its saturation and tone but rotates
|
|
317
|
+
* the hue.
|
|
318
|
+
*/
|
|
319
|
+
from?: GlazeColorValue;
|
|
320
|
+
/**
|
|
321
|
+
* Tone value (0–100, contrast-uniform — see `docs/okhst.mdx`).
|
|
178
322
|
* - Number: absolute tone.
|
|
179
323
|
* - String ('+N' / '-N'): relative to base color's tone (requires `base`).
|
|
180
324
|
* - `'max'` / `'min'`: force to the scheme's tone extreme (no base needed).
|
|
325
|
+
*
|
|
326
|
+
* Defaults to the tone of `from` when that is set.
|
|
181
327
|
*/
|
|
182
328
|
tone?: HCPair<ToneValue>;
|
|
183
|
-
/**
|
|
329
|
+
/**
|
|
330
|
+
* Saturation factor applied to the seed saturation (0–1, default: 1).
|
|
331
|
+
*
|
|
332
|
+
* With `from`, an explicit value here is still a factor of the seed and
|
|
333
|
+
* overrides the absolute saturation the color carried.
|
|
334
|
+
*/
|
|
184
335
|
saturation?: number;
|
|
185
336
|
/**
|
|
186
337
|
* Hue override for this color.
|
|
@@ -188,6 +339,26 @@ interface RegularColorDef {
|
|
|
188
339
|
* - String ('+N' / '-N'): relative to the theme seed hue.
|
|
189
340
|
*/
|
|
190
341
|
hue?: number | RelativeValue;
|
|
342
|
+
/**
|
|
343
|
+
* Dark-scheme hue override. Applies to the `dark` and `darkContrast`
|
|
344
|
+
* variants; falls back to `hue` when omitted.
|
|
345
|
+
* - Number: absolute hue (0–360).
|
|
346
|
+
* - String ('+N' / '-N'): relative to the theme's **dark** seed hue
|
|
347
|
+
* (`GlazeTheme.darkHue`, itself defaulting to the light seed hue).
|
|
348
|
+
*
|
|
349
|
+
* Ignored under `mode: 'static'`, which pins one value across all schemes.
|
|
350
|
+
*/
|
|
351
|
+
darkHue?: number | RelativeValue;
|
|
352
|
+
/**
|
|
353
|
+
* Dark-scheme saturation factor (0–1) applied to the dark seed
|
|
354
|
+
* saturation. Applies to the `dark` and `darkContrast` variants; falls
|
|
355
|
+
* back to `saturation` when omitted.
|
|
356
|
+
*
|
|
357
|
+
* When set, the global `darkDesaturation` reduction is **not** applied on
|
|
358
|
+
* top — the resulting saturation is taken literally. Ignored under
|
|
359
|
+
* `mode: 'static'`.
|
|
360
|
+
*/
|
|
361
|
+
darkSaturation?: number;
|
|
191
362
|
/** Name of another color in the same theme (dependent color). */
|
|
192
363
|
base?: string;
|
|
193
364
|
/**
|
|
@@ -201,14 +372,15 @@ interface RegularColorDef {
|
|
|
201
372
|
* Whether to flip out-of-bounds results to the opposite side instead of
|
|
202
373
|
* clamping to the extreme. Affects both:
|
|
203
374
|
* - relative `tone`: when `base ± delta` exceeds `[0, 100]`, mirror the
|
|
204
|
-
* delta to the other side of the base.
|
|
375
|
+
* delta to the other side of the base. If the mirrored target is also
|
|
376
|
+
* out of range, keep the original delta and clamp on the authored side.
|
|
205
377
|
* - `contrast`: when the requested direction can't meet the floor, try the
|
|
206
378
|
* opposite side (same as the global `autoFlip`).
|
|
207
379
|
*
|
|
208
380
|
* Defaults to the global `autoFlip` config (default `true`). Set `false`
|
|
209
381
|
* to clamp instead.
|
|
210
382
|
*/
|
|
211
|
-
|
|
383
|
+
autoFlip?: boolean;
|
|
212
384
|
/**
|
|
213
385
|
* Fixed opacity (0–1).
|
|
214
386
|
* Output includes alpha in the CSS value.
|
|
@@ -220,54 +392,83 @@ interface RegularColorDef {
|
|
|
220
392
|
/**
|
|
221
393
|
* Per-color override for the hue-independent "safe" chroma limit used in
|
|
222
394
|
* OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
|
|
223
|
-
* Falls through to the
|
|
224
|
-
* @see
|
|
395
|
+
* Falls through to the per-theme / per-token `pastel` override when omitted.
|
|
396
|
+
* @see GlazeConfigOverride.pastel
|
|
225
397
|
*/
|
|
226
398
|
pastel?: boolean;
|
|
399
|
+
/**
|
|
400
|
+
* Semantic role against `base`: how this color is used. Fixes APCA contrast
|
|
401
|
+
* polarity (the argument order in `apcaContrast`). WCAG is symmetric so it
|
|
402
|
+
* never affects WCAG results.
|
|
403
|
+
*
|
|
404
|
+
* Resolution: explicit `role` wins; else inferred from the color name when
|
|
405
|
+
* `inferRole` is enabled (default); else the opposite of the base's role;
|
|
406
|
+
* else defaults to `'text'` (foreground).
|
|
407
|
+
*/
|
|
408
|
+
role?: RoleInput;
|
|
227
409
|
/**
|
|
228
410
|
* Whether this color is inherited by child themes created via `extend()`.
|
|
229
411
|
* Default: true. Set to false to make this color local to the current theme.
|
|
230
412
|
*/
|
|
231
413
|
inherit?: boolean;
|
|
232
414
|
}
|
|
233
|
-
/**
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
415
|
+
/**
|
|
416
|
+
* Tuning shared by `shadow` and `glow`. Global defaults come from
|
|
417
|
+
* `shadowTuning` / `glowTuning`; a per-color `tuning` merges over them field
|
|
418
|
+
* by field.
|
|
419
|
+
*/
|
|
420
|
+
interface LightingTuning {
|
|
421
|
+
/**
|
|
422
|
+
* β — how strongly the object (`fg`) scales the step. The step is
|
|
423
|
+
* `intensity × k` with `k = max(0, 1 + β · d · (t_bg − t_fg) / 100)`,
|
|
424
|
+
* `d = +1` for a shadow and `−1` for a glow: a darker object deepens its
|
|
425
|
+
* shadow, a lighter one strengthens its glow. An object at the surface's
|
|
426
|
+
* own tone (or no `fg`) gives exactly `intensity`. `0` ignores the object.
|
|
427
|
+
* Default: 0.5.
|
|
428
|
+
*/
|
|
429
|
+
objectInfluence?: number;
|
|
430
|
+
/**
|
|
431
|
+
* Pigment saturation (0–1) in the surface's hue. Default: 0 (neutral black /
|
|
432
|
+
* white). Shows only with `reach` below 1 — pure black and white have no hue.
|
|
433
|
+
*/
|
|
434
|
+
tint?: number;
|
|
243
435
|
/**
|
|
244
|
-
*
|
|
245
|
-
* Default:
|
|
436
|
+
* Where the pigment sits (0–1): the fraction of the way from the surface's
|
|
437
|
+
* tone to black (shadow) / white (glow). Default: 1 (pure black / white),
|
|
438
|
+
* the most reach. Lower values let a `tint` show at the cost of reach.
|
|
246
439
|
*/
|
|
247
|
-
|
|
248
|
-
/** Max alpha (0-1). Reached at intensity=100 with max contrast. Default: 1.0. */
|
|
249
|
-
alphaMax?: number;
|
|
440
|
+
reach?: number;
|
|
250
441
|
/**
|
|
251
|
-
*
|
|
252
|
-
* 0
|
|
442
|
+
* Pull (0–1) of the pigment hue from the surface's hue toward the object's
|
|
443
|
+
* (`fg`) hue. Default: 0. Needs `fg`, a `tint`, and `reach` below 1 to show.
|
|
253
444
|
*/
|
|
254
|
-
|
|
445
|
+
hueBleed?: number;
|
|
255
446
|
}
|
|
447
|
+
/** Tuning for `shadow` colors. Same shape as {@link GlowTuning}. */
|
|
448
|
+
type ShadowTuning = LightingTuning;
|
|
449
|
+
/** Tuning for `glow` colors. Same shape as {@link ShadowTuning}. */
|
|
450
|
+
type GlowTuning = LightingTuning;
|
|
451
|
+
/**
|
|
452
|
+
* A translucent dark overlay that lands the surface (`bg`) exactly
|
|
453
|
+
* `intensity` tones darker in every scheme — a shade for state layers and
|
|
454
|
+
* scrims, or, with `fg`, an object-aware drop shadow.
|
|
455
|
+
*/
|
|
256
456
|
interface ShadowColorDef {
|
|
257
457
|
type: 'shadow';
|
|
258
458
|
/**
|
|
259
|
-
*
|
|
260
|
-
*
|
|
459
|
+
* The surface the shadow falls on. Must reference a color that is not a
|
|
460
|
+
* shadow or glow.
|
|
261
461
|
*/
|
|
262
462
|
bg: string;
|
|
263
463
|
/**
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
* Omit for
|
|
464
|
+
* The object casting the shadow (e.g. the card). A darker object casts a
|
|
465
|
+
* deeper shadow, a lighter one a softer shadow — see
|
|
466
|
+
* `LightingTuning.objectInfluence`. Omit for an exact shade of `intensity`
|
|
467
|
+
* tones. Must reference a color that is not a shadow or glow.
|
|
267
468
|
*/
|
|
268
469
|
fg?: string;
|
|
269
470
|
/**
|
|
270
|
-
*
|
|
471
|
+
* Tone step, 0–100: how many tones darker than `bg` the composite lands.
|
|
271
472
|
* Supports [normal, highContrast] pair.
|
|
272
473
|
*/
|
|
273
474
|
intensity: HCPair<number>;
|
|
@@ -276,8 +477,46 @@ interface ShadowColorDef {
|
|
|
276
477
|
/**
|
|
277
478
|
* Per-color override for the hue-independent "safe" chroma limit used in
|
|
278
479
|
* OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
|
|
279
|
-
* Falls through to the
|
|
280
|
-
* @see
|
|
480
|
+
* Falls through to the per-theme / per-token `pastel` override when omitted.
|
|
481
|
+
* @see GlazeConfigOverride.pastel
|
|
482
|
+
*/
|
|
483
|
+
pastel?: boolean;
|
|
484
|
+
/**
|
|
485
|
+
* Whether this color is inherited by child themes created via `extend()`.
|
|
486
|
+
* Default: true. Set to false to make this color local to the current theme.
|
|
487
|
+
*/
|
|
488
|
+
inherit?: boolean;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* The mirror of {@link ShadowColorDef}: a translucent light overlay that lands
|
|
492
|
+
* the surface (`bg`) exactly `intensity` tones lighter in every scheme — for
|
|
493
|
+
* dark-mode elevation, edge highlights, and lightening state layers.
|
|
494
|
+
*/
|
|
495
|
+
interface GlowColorDef {
|
|
496
|
+
type: 'glow';
|
|
497
|
+
/**
|
|
498
|
+
* The surface the glow falls on. Must reference a color that is not a
|
|
499
|
+
* shadow or glow.
|
|
500
|
+
*/
|
|
501
|
+
bg: string;
|
|
502
|
+
/**
|
|
503
|
+
* The object emitting the glow. A lighter object glows stronger, a darker
|
|
504
|
+
* one weaker — see `LightingTuning.objectInfluence`. Omit for an exact tint
|
|
505
|
+
* of `intensity` tones. Must reference a color that is not a shadow or glow.
|
|
506
|
+
*/
|
|
507
|
+
fg?: string;
|
|
508
|
+
/**
|
|
509
|
+
* Tone step, 0–100: how many tones lighter than `bg` the composite lands.
|
|
510
|
+
* Supports [normal, highContrast] pair.
|
|
511
|
+
*/
|
|
512
|
+
intensity: HCPair<number>;
|
|
513
|
+
/** Override default tuning. Merged field-by-field with global `glowTuning`. */
|
|
514
|
+
tuning?: GlowTuning;
|
|
515
|
+
/**
|
|
516
|
+
* Per-color override for the hue-independent "safe" chroma limit used in
|
|
517
|
+
* OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
|
|
518
|
+
* Falls through to the per-theme / per-token `pastel` override when omitted.
|
|
519
|
+
* @see GlazeConfigOverride.pastel
|
|
281
520
|
*/
|
|
282
521
|
pastel?: boolean;
|
|
283
522
|
/**
|
|
@@ -307,9 +546,12 @@ interface MixColorDef {
|
|
|
307
546
|
/**
|
|
308
547
|
* Interpolation color space for opaque blending. Default: 'okhsl'.
|
|
309
548
|
* - 'okhsl': perceptually uniform, consistent with Glaze's internal model.
|
|
310
|
-
* - 'srgb': linear sRGB interpolation
|
|
549
|
+
* - 'srgb': linear-light sRGB interpolation (like CSS
|
|
550
|
+
* `color-mix(in srgb-linear, …)`).
|
|
311
551
|
*
|
|
312
|
-
* Ignored for 'transparent' blend
|
|
552
|
+
* Ignored for 'transparent' blend: the browser composites that one, and
|
|
553
|
+
* its contrast solve models the browser (`source-over` on gamma-encoded
|
|
554
|
+
* sRGB).
|
|
313
555
|
*/
|
|
314
556
|
space?: 'okhsl' | 'srgb';
|
|
315
557
|
/**
|
|
@@ -323,17 +565,23 @@ interface MixColorDef {
|
|
|
323
565
|
/**
|
|
324
566
|
* Per-color override for the hue-independent "safe" chroma limit used in
|
|
325
567
|
* OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
|
|
326
|
-
* Falls through to the
|
|
327
|
-
* @see
|
|
568
|
+
* Falls through to the per-theme / per-token `pastel` override when omitted.
|
|
569
|
+
* @see GlazeConfigOverride.pastel
|
|
328
570
|
*/
|
|
329
571
|
pastel?: boolean;
|
|
572
|
+
/**
|
|
573
|
+
* Semantic role of the mixed result against `base`. Same semantics as
|
|
574
|
+
* `RegularColorDef.role` (fixes APCA polarity). Resolution and defaults
|
|
575
|
+
* are identical.
|
|
576
|
+
*/
|
|
577
|
+
role?: RoleInput;
|
|
330
578
|
/**
|
|
331
579
|
* Whether this color is inherited by child themes created via `extend()`.
|
|
332
580
|
* Default: true. Set to false to make this color local to the current theme.
|
|
333
581
|
*/
|
|
334
582
|
inherit?: boolean;
|
|
335
583
|
}
|
|
336
|
-
type ColorDef = RegularColorDef | ShadowColorDef | MixColorDef;
|
|
584
|
+
type ColorDef = RegularColorDef | ShadowColorDef | GlowColorDef | MixColorDef;
|
|
337
585
|
type ColorMap = Record<string, ColorDef>;
|
|
338
586
|
/**
|
|
339
587
|
* Resolved color for a single scheme variant.
|
|
@@ -365,7 +613,7 @@ interface ResolvedColor {
|
|
|
365
613
|
dark: ResolvedColorVariant;
|
|
366
614
|
lightContrast: ResolvedColorVariant;
|
|
367
615
|
darkContrast: ResolvedColorVariant;
|
|
368
|
-
/** Adaptation mode
|
|
616
|
+
/** Adaptation mode of a regular color; `undefined` for shadow / glow / mix. */
|
|
369
617
|
mode?: AdaptationMode;
|
|
370
618
|
}
|
|
371
619
|
/**
|
|
@@ -389,15 +637,49 @@ interface GlazeConfig {
|
|
|
389
637
|
darkTone?: ToneWindow;
|
|
390
638
|
/** Saturation reduction factor for dark scheme (0–1). Default: 0.1. */
|
|
391
639
|
darkDesaturation?: number;
|
|
392
|
-
/**
|
|
640
|
+
/**
|
|
641
|
+
* State alias names for Tasty token export. Default to media-query states
|
|
642
|
+
* (`'@media(prefers-color-scheme: dark)'` / `'@media(prefers-contrast: more)'`)
|
|
643
|
+
* so tokens react to the OS preference without registering custom states.
|
|
644
|
+
*/
|
|
393
645
|
states?: {
|
|
394
646
|
dark?: string;
|
|
395
647
|
highContrast?: string;
|
|
396
648
|
};
|
|
397
|
-
/**
|
|
649
|
+
/**
|
|
650
|
+
* Which scheme variants to include in exports. Defaults: `dark: true`,
|
|
651
|
+
* `highContrast: false`.
|
|
652
|
+
*/
|
|
398
653
|
modes?: GlazeOutputModes;
|
|
399
654
|
/** Default tuning for all shadow colors. Per-color tuning merges field-by-field. */
|
|
400
655
|
shadowTuning?: ShadowTuning;
|
|
656
|
+
/** Default tuning for all glow colors. Per-color tuning merges field-by-field. */
|
|
657
|
+
glowTuning?: GlowTuning;
|
|
658
|
+
/**
|
|
659
|
+
* Manual contrast level — a 0–100 slider from normal contrast (`0`) to high
|
|
660
|
+
* contrast (`100`), or `'auto'` (the default) to take the authored normal
|
|
661
|
+
* entries as-is.
|
|
662
|
+
*
|
|
663
|
+
* With a number, Glaze resolves the `light` / `dark` variants *at* that level.
|
|
664
|
+
* That is all it does: `lightContrast` / `darkContrast` stay the true
|
|
665
|
+
* high-contrast resolution at every level, and `modes.highContrast` alone
|
|
666
|
+
* decides whether they are emitted. Level `0` therefore reproduces `'auto'`
|
|
667
|
+
* bit for bit. At `100` the normal variants *are* the high-contrast ones, so a
|
|
668
|
+
* separate tier would duplicate them and a global level of 100 drops it.
|
|
669
|
+
*
|
|
670
|
+
* The level interpolates all three things that make high contrast differ:
|
|
671
|
+
* authored `[normal, highContrast]` pairs, the tone-window widening, and
|
|
672
|
+
* the `AA → AAA` / APCA `+15 Lc` escalation. Contrast floors are re-solved
|
|
673
|
+
* at the interpolated target, so every level is a solution rather than an
|
|
674
|
+
* approximation, and a color keeps to one side of its base as the level moves.
|
|
675
|
+
*
|
|
676
|
+
* Pass `'auto'` to leave manual mode; `configure()` never clears a field by
|
|
677
|
+
* omission. See `docs/reference/contrast.md` for the ramp's edge cases (un-interpolable
|
|
678
|
+
* pairs, side changes) and the export-freeze rule.
|
|
679
|
+
*
|
|
680
|
+
* @default 'auto'
|
|
681
|
+
*/
|
|
682
|
+
contrastLevel?: number | 'auto';
|
|
401
683
|
/**
|
|
402
684
|
* Automatically flip tone direction when contrast can't be met.
|
|
403
685
|
*
|
|
@@ -414,12 +696,12 @@ interface GlazeConfig {
|
|
|
414
696
|
*/
|
|
415
697
|
autoFlip?: boolean;
|
|
416
698
|
/**
|
|
417
|
-
* If true,
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
* @default
|
|
699
|
+
* If true (default), infer a color's `role` from its name when no explicit
|
|
700
|
+
* `role` is set. Set to `false` to opt out of name-based inference (the
|
|
701
|
+
* base-opposite and default-foreground fallbacks still apply).
|
|
702
|
+
* @default true
|
|
421
703
|
*/
|
|
422
|
-
|
|
704
|
+
inferRole?: boolean;
|
|
423
705
|
}
|
|
424
706
|
interface GlazeConfigResolved {
|
|
425
707
|
lightTone: ToneWindow;
|
|
@@ -431,13 +713,27 @@ interface GlazeConfigResolved {
|
|
|
431
713
|
};
|
|
432
714
|
modes: Required<GlazeOutputModes>;
|
|
433
715
|
shadowTuning?: ShadowTuning;
|
|
716
|
+
glowTuning?: GlowTuning;
|
|
434
717
|
autoFlip: boolean;
|
|
718
|
+
/**
|
|
719
|
+
* Manual contrast level (0–100) for the normal variants, or `'auto'` to take
|
|
720
|
+
* the authored normal entries as-is.
|
|
721
|
+
* @see GlazeConfig.contrastLevel
|
|
722
|
+
*/
|
|
723
|
+
contrastLevel: number | 'auto';
|
|
724
|
+
/**
|
|
725
|
+
* Instance-level pastel default (`def.pastel ?? config.pastel`).
|
|
726
|
+
* Not set via `glaze.configure()` — only via per-theme / per-token
|
|
727
|
+
* `GlazeConfigOverride` (default `false`).
|
|
728
|
+
*/
|
|
435
729
|
pastel: boolean;
|
|
730
|
+
inferRole: boolean;
|
|
436
731
|
}
|
|
437
732
|
/**
|
|
438
733
|
* Per-instance config override for `glaze.color()` and `glaze()` themes.
|
|
439
734
|
* Fields that are set take priority over the live global config. Fields
|
|
440
|
-
* that are omitted fall through to the live global at resolve time
|
|
735
|
+
* that are omitted fall through to the live global at resolve time
|
|
736
|
+
* (`pastel` is instance-only and defaults to `false` when omitted).
|
|
441
737
|
*
|
|
442
738
|
* `false` for a tone window disables clamping (full range at reference eps).
|
|
443
739
|
*/
|
|
@@ -451,52 +747,112 @@ interface GlazeConfigOverride {
|
|
|
451
747
|
/** Whether to auto-flip tone when contrast can't be met. */
|
|
452
748
|
autoFlip?: boolean;
|
|
453
749
|
/**
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
750
|
+
* Manual contrast level (0–100) for this instance, or `'auto'` to opt out of a
|
|
751
|
+
* global level and take the authored normal entries as-is. Either way the
|
|
752
|
+
* instance keeps its high-contrast tier; a per-instance level never changes
|
|
753
|
+
* which modes are emitted.
|
|
754
|
+
*
|
|
755
|
+
* Only an instance-authored level is frozen into `.export()` snapshots — a
|
|
756
|
+
* level inherited from the global config is treated as a live preference and
|
|
757
|
+
* re-read at restore time.
|
|
758
|
+
*
|
|
759
|
+
* @see GlazeConfig.contrastLevel
|
|
760
|
+
*/
|
|
761
|
+
contrastLevel?: number | 'auto';
|
|
762
|
+
/**
|
|
763
|
+
* Instance-level pastel default for colors that omit per-color `pastel`.
|
|
764
|
+
* Not available on `glaze.configure()` — set here or per-color.
|
|
765
|
+
* @default false
|
|
457
766
|
*/
|
|
458
767
|
pastel?: boolean;
|
|
768
|
+
/**
|
|
769
|
+
* If true, infer a color's `role` from its name when no explicit `role` is
|
|
770
|
+
* set. Falls through to the live global at resolve time when omitted.
|
|
771
|
+
*/
|
|
772
|
+
inferRole?: boolean;
|
|
459
773
|
/**
|
|
460
774
|
* Shadow tuning defaults. Only meaningful for themes; harmless on
|
|
461
775
|
* standalone color tokens.
|
|
462
776
|
*/
|
|
463
777
|
shadowTuning?: ShadowTuning;
|
|
778
|
+
/**
|
|
779
|
+
* Glow tuning defaults. Only meaningful for themes; harmless on
|
|
780
|
+
* standalone color tokens.
|
|
781
|
+
*/
|
|
782
|
+
glowTuning?: GlowTuning;
|
|
464
783
|
}
|
|
784
|
+
/**
|
|
785
|
+
* Current authoring-export schema version. Bump when the export shape
|
|
786
|
+
* changes in a non-compatible way. Written on every `.export()` snapshot.
|
|
787
|
+
*
|
|
788
|
+
* - `1` — Glaze 2.x.
|
|
789
|
+
* - `2` — Glaze 3: `shadow` `intensity` / `fg` / `tuning` changed meaning and
|
|
790
|
+
* `glow` was added. Version-1 theme snapshots that carry shadow defs or a
|
|
791
|
+
* `shadowTuning` are rejected on restore.
|
|
792
|
+
*/
|
|
793
|
+
declare const GLAZE_EXPORT_VERSION: 2;
|
|
794
|
+
/** Literal type of {@link GLAZE_EXPORT_VERSION}. */
|
|
795
|
+
type GlazeExportVersion = typeof GLAZE_EXPORT_VERSION;
|
|
796
|
+
/** Discriminator for authoring export snapshots. */
|
|
797
|
+
type GlazeExportKind = 'theme' | 'color' | 'palette';
|
|
465
798
|
/** Serialized theme configuration (no resolved values). */
|
|
466
799
|
interface GlazeThemeExport {
|
|
800
|
+
/** Snapshot kind. Always written by `theme.export()`; optional on legacy hand-written configs. */
|
|
801
|
+
kind?: 'theme';
|
|
802
|
+
/** Schema version. Always written by `theme.export()`; optional on legacy configs. */
|
|
803
|
+
version?: number;
|
|
467
804
|
hue: number;
|
|
468
805
|
saturation: number;
|
|
806
|
+
/** Dark-scheme seed hue (0–360). Omitted when the theme reuses `hue`. */
|
|
807
|
+
darkHue?: number;
|
|
808
|
+
/** Dark-scheme seed saturation (0–100). Omitted when the theme reuses `saturation`. */
|
|
809
|
+
darkSaturation?: number;
|
|
469
810
|
colors: ColorMap;
|
|
470
|
-
/**
|
|
811
|
+
/**
|
|
812
|
+
* Effective config freeze from `.export()` —
|
|
813
|
+
* `getConfig() ∪ instance local ∪ exportArg`. May be sparse on legacy
|
|
814
|
+
* snapshots (omitted fields fall through to the live global at restore).
|
|
815
|
+
*/
|
|
471
816
|
config?: GlazeConfigOverride;
|
|
472
817
|
}
|
|
473
|
-
/** Input for `glaze.shadow()` standalone
|
|
474
|
-
interface
|
|
818
|
+
/** Input for the `glaze.shadow()` and `glaze.glow()` standalone factories. */
|
|
819
|
+
interface GlazeLightingInput {
|
|
475
820
|
/**
|
|
476
|
-
*
|
|
477
|
-
* (`#rgb` / `#rrggbb` / `#rrggbbaa`), `rgb()` / `hsl()` /
|
|
478
|
-
* / `oklch()` strings, or literal objects
|
|
479
|
-
* `{
|
|
821
|
+
* The surface — accepts any `GlazeColorValue` form: hex
|
|
822
|
+
* (`#rgb` / `#rgba` / `#rrggbb` / `#rrggbbaa`), `rgb()` / `hsl()` /
|
|
823
|
+
* `okhsl()` / `okhst()` / `oklch()` strings, or literal objects
|
|
824
|
+
* (`{ r, g, b }`, `{ h, s, l }`, `{ h, s, t }`, `{ l, c, h }`). Alpha
|
|
825
|
+
* components are dropped with a warning.
|
|
480
826
|
*/
|
|
481
827
|
bg: GlazeColorValue;
|
|
482
|
-
/**
|
|
483
|
-
* Foreground color for tinting + intensity modulation. Accepts the
|
|
484
|
-
* same forms as `bg`.
|
|
485
|
-
*/
|
|
828
|
+
/** The object casting the shadow / emitting the glow. Same forms as `bg`. */
|
|
486
829
|
fg?: GlazeColorValue;
|
|
487
|
-
/**
|
|
830
|
+
/** Tone step, 0–100. */
|
|
488
831
|
intensity: number;
|
|
489
|
-
tuning?:
|
|
832
|
+
tuning?: LightingTuning;
|
|
490
833
|
}
|
|
834
|
+
/** Input for `glaze.shadow()`. */
|
|
835
|
+
type GlazeShadowInput = GlazeLightingInput;
|
|
836
|
+
/** Input for `glaze.glow()`. */
|
|
837
|
+
type GlazeGlowInput = GlazeLightingInput;
|
|
491
838
|
/** Input for the structured `glaze.color()` overload. */
|
|
492
839
|
interface GlazeColorInput {
|
|
493
840
|
hue: number;
|
|
494
841
|
saturation: number;
|
|
495
842
|
tone: HCPair<number | ExtremeValue>;
|
|
496
843
|
saturationFactor?: number;
|
|
844
|
+
/**
|
|
845
|
+
* Dark-scheme hue. Number is absolute (0–360); `'+N'`/`'-N'` is relative
|
|
846
|
+
* to the dark seed hue, which defaults to `hue`. Falls back to `hue`.
|
|
847
|
+
*/
|
|
848
|
+
darkHue?: number | RelativeValue;
|
|
849
|
+
/** Dark-scheme seed saturation (0–100). Defaults to `saturation`. */
|
|
850
|
+
darkSaturation?: number;
|
|
851
|
+
/** Dark-scheme multiplier on the dark seed (0–1). Defaults to `saturationFactor`. */
|
|
852
|
+
darkSaturationFactor?: number;
|
|
497
853
|
mode?: AdaptationMode;
|
|
498
854
|
/** Flip out-of-bounds results instead of clamping. Default: global `autoFlip`. */
|
|
499
|
-
|
|
855
|
+
autoFlip?: boolean;
|
|
500
856
|
/**
|
|
501
857
|
* Fixed opacity (0–1). Output includes alpha in the CSS value.
|
|
502
858
|
* Combining with `contrast` is not recommended (perceived tone
|
|
@@ -510,39 +866,69 @@ interface GlazeColorInput {
|
|
|
510
866
|
*/
|
|
511
867
|
base?: GlazeColorToken | GlazeColorValue;
|
|
512
868
|
/**
|
|
513
|
-
* Contrast floor
|
|
869
|
+
* Contrast floor. Without `base`, solved against the token's own input
|
|
870
|
+
* color (`hue`, `saturation`, normal `tone`), held fixed in every scheme;
|
|
871
|
+
* with `base`, against the base's resolved variant per scheme. A bare
|
|
514
872
|
* number/preset is WCAG; use `{ wcag }` / `{ apca }` to pick the metric.
|
|
515
873
|
*/
|
|
516
874
|
contrast?: HCPair<ContrastSpec>;
|
|
517
875
|
/**
|
|
518
876
|
* Optional human-readable name for the token. Used in error and
|
|
519
877
|
* warning messages (otherwise an internal name like `"value"` is
|
|
520
|
-
* used).
|
|
878
|
+
* used) and as `resolve().name`. A debug label only: it does not
|
|
879
|
+
* affect output keys or the token's `role`.
|
|
521
880
|
*/
|
|
522
881
|
name?: string;
|
|
523
882
|
/**
|
|
524
883
|
* Per-color override for the hue-independent "safe" chroma limit used in
|
|
525
884
|
* OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
|
|
526
|
-
* Falls through to the
|
|
527
|
-
* @see
|
|
885
|
+
* Falls through to the per-theme / per-token `pastel` override when omitted.
|
|
886
|
+
* @see GlazeConfigOverride.pastel
|
|
528
887
|
*/
|
|
529
888
|
pastel?: boolean;
|
|
889
|
+
/**
|
|
890
|
+
* Semantic role against the token's anchor (`base`, or its own input
|
|
891
|
+
* color when `contrast` is set without one): how this token is used.
|
|
892
|
+
* Fixes APCA contrast polarity; WCAG ignores it. Defaults to `'text'` —
|
|
893
|
+
* the token is the foreground and the anchor the background, with or
|
|
894
|
+
* without `base`. Unlike a theme color, a token never infers its role
|
|
895
|
+
* from `name`, so `inferRole` has no effect on it.
|
|
896
|
+
*/
|
|
897
|
+
role?: RoleInput;
|
|
530
898
|
}
|
|
531
899
|
/**
|
|
532
900
|
* Any single-color input form accepted by the value-shorthand
|
|
533
901
|
* overload of `glaze.color()`.
|
|
534
902
|
*
|
|
535
|
-
* Strings cover hex (`#rgb` / `#
|
|
536
|
-
*
|
|
537
|
-
* `
|
|
538
|
-
*
|
|
903
|
+
* Strings cover hex with a leading `#` (`#rgb` / `#rgba` / `#rrggbb` /
|
|
904
|
+
* `#rrggbbaa`) and the five color functions Glaze itself emits: `rgb()`,
|
|
905
|
+
* `hsl()`, `okhsl()`, `okhst()`, `oklch()`, plus the `rgba()` / `hsla()`
|
|
906
|
+
* aliases. Function names are case-insensitive; components are numbers or
|
|
907
|
+
* percentages, separated by spaces or commas. Their scales:
|
|
908
|
+
* - `rgb()` — channels 0–255, or percentages (`100%` is 255).
|
|
909
|
+
* - `hsl()` / `okhsl()` / `okhst()` — saturation, lightness and tone are
|
|
910
|
+
* percentages or bare 0–1 fractions: `hsl(120 50% 50%)` or
|
|
911
|
+
* `hsl(120 0.5 0.5)`. Unlike CSS, a bare `hsl(120 50 50)` does not mean
|
|
912
|
+
* 50%; it is out of range and resolves to white without a warning.
|
|
913
|
+
* - `oklch()` — L 0–1 or a percentage; C bare, or a percentage where
|
|
914
|
+
* `100%` is 0.4.
|
|
915
|
+
* - Hue is in degrees, bare or with `deg`. Other angle units (`turn`,
|
|
916
|
+
* `rad`, `grad`) are misread as degrees rather than rejected.
|
|
539
917
|
*
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
918
|
+
* An alpha component (hex alpha, `/ A`, or any fourth component) is
|
|
919
|
+
* dropped with a warning. Named colors, other color functions, and
|
|
920
|
+
* relative color syntax throw.
|
|
921
|
+
*
|
|
922
|
+
* Literal object forms, told apart by their keys:
|
|
544
923
|
* - `{ r, g, b }` — sRGB 0–255.
|
|
545
924
|
* - `{ l, c, h }` — OKLCh (L/C: 0–1, H: degrees), same as `oklch()` strings.
|
|
925
|
+
* - `{ h, s, t }` — OKHST (h: 0–360, s/t: 0–1). Tone in 0–1, so `t: 0.7` is
|
|
926
|
+
* tone 70.
|
|
927
|
+
* - `{ h, s, l }` — OKHSL (h: 0–360, s/l: 0–1).
|
|
928
|
+
*
|
|
929
|
+
* An object `s`, `l`, `t` or `c` above 1.5 throws, which catches 0–100
|
|
930
|
+
* input; the OKHSL / OKHST errors point to the structured form. String
|
|
931
|
+
* components have no such check.
|
|
546
932
|
*/
|
|
547
933
|
type GlazeColorValue = string | OkhslColor | OkhstColor | RgbColor | OklchColor;
|
|
548
934
|
/** Color overrides for the `from` and value-shorthand inputs. */
|
|
@@ -555,6 +941,23 @@ interface GlazeColorOverrides {
|
|
|
555
941
|
hue?: number | RelativeValue;
|
|
556
942
|
/** Override seed saturation (0–100). Default: extracted from value. */
|
|
557
943
|
saturation?: number;
|
|
944
|
+
/**
|
|
945
|
+
* Dark-scheme hue. Number is absolute (0–360); `'+N'`/`'-N'` is relative
|
|
946
|
+
* to the dark seed hue, which defaults to the (possibly overridden) seed
|
|
947
|
+
* hue. Falls back to `hue` when omitted.
|
|
948
|
+
*/
|
|
949
|
+
darkHue?: number | RelativeValue;
|
|
950
|
+
/**
|
|
951
|
+
* Dark-scheme seed saturation (0–100). Defaults to `saturation`. When set,
|
|
952
|
+
* the global `darkDesaturation` reduction is not applied on top.
|
|
953
|
+
*/
|
|
954
|
+
darkSaturation?: number;
|
|
955
|
+
/**
|
|
956
|
+
* Dark-scheme multiplier on the dark seed (0–1). Defaults to
|
|
957
|
+
* `saturationFactor`. When set, the global `darkDesaturation` reduction is
|
|
958
|
+
* not applied on top.
|
|
959
|
+
*/
|
|
960
|
+
darkSaturationFactor?: number;
|
|
558
961
|
/**
|
|
559
962
|
* Override tone. Number is absolute (0–100, contrast-uniform); `'+N'`/`'-N'`
|
|
560
963
|
* is relative to the literal seed (the value passed to `glaze.color()`);
|
|
@@ -567,11 +970,11 @@ interface GlazeColorOverrides {
|
|
|
567
970
|
/**
|
|
568
971
|
* Adaptation mode. Defaults to `'auto'` for every input form, so
|
|
569
972
|
* colors automatically adapt between light and dark like an ordinary
|
|
570
|
-
* theme color.
|
|
571
|
-
* preserve light tone
|
|
572
|
-
*
|
|
573
|
-
* `{ hue, saturation, tone }` form also
|
|
574
|
-
*
|
|
973
|
+
* theme color. Value-shorthand inputs (strings and literal objects)
|
|
974
|
+
* preserve light tone via a local `lightTone: false` default; other
|
|
975
|
+
* omitted config fields fall through to the live global at resolve
|
|
976
|
+
* time. Structured `{ hue, saturation, tone }` form also falls
|
|
977
|
+
* through for both tone windows unless overridden.
|
|
575
978
|
*
|
|
576
979
|
* Pass `'fixed'` explicitly to opt back into the linear, non-
|
|
577
980
|
* inverting mapping; pass `'static'` to pin the same tone
|
|
@@ -583,7 +986,7 @@ interface GlazeColorOverrides {
|
|
|
583
986
|
* `contrast`) to the opposite side instead of clamping. Defaults to
|
|
584
987
|
* the global `autoFlip`.
|
|
585
988
|
*/
|
|
586
|
-
|
|
989
|
+
autoFlip?: boolean;
|
|
587
990
|
/**
|
|
588
991
|
* Contrast floor. By default solved against the literal seed
|
|
589
992
|
* (the value itself); when `base` is set, solved against the base's
|
|
@@ -624,16 +1027,26 @@ interface GlazeColorOverrides {
|
|
|
624
1027
|
/**
|
|
625
1028
|
* Optional human-readable name for the token. Used in error and
|
|
626
1029
|
* warning messages (otherwise an internal name like `"value"` is
|
|
627
|
-
* used).
|
|
1030
|
+
* used) and as `resolve().name`. A debug label only: it does not
|
|
1031
|
+
* affect output keys or the token's `role`.
|
|
628
1032
|
*/
|
|
629
1033
|
name?: string;
|
|
630
1034
|
/**
|
|
631
1035
|
* Per-color override for the hue-independent "safe" chroma limit used in
|
|
632
1036
|
* OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
|
|
633
|
-
* Falls through to the
|
|
634
|
-
* @see
|
|
1037
|
+
* Falls through to the per-theme / per-token `pastel` override when omitted.
|
|
1038
|
+
* @see GlazeConfigOverride.pastel
|
|
635
1039
|
*/
|
|
636
1040
|
pastel?: boolean;
|
|
1041
|
+
/**
|
|
1042
|
+
* Semantic role against the token's anchor (`base`, or the literal seed
|
|
1043
|
+
* when `contrast` / a relative `tone` is set without one): how this token
|
|
1044
|
+
* is used. Fixes APCA contrast polarity; WCAG ignores it. Defaults to
|
|
1045
|
+
* `'text'` — the token is the foreground and the anchor the background,
|
|
1046
|
+
* with or without `base`. Unlike a theme color, a token never infers its
|
|
1047
|
+
* role from `name`, so `inferRole` has no effect on it.
|
|
1048
|
+
*/
|
|
1049
|
+
role?: RoleInput;
|
|
637
1050
|
}
|
|
638
1051
|
/**
|
|
639
1052
|
* Object input for `glaze.color()` that carries a raw color value plus
|
|
@@ -656,13 +1069,19 @@ interface GlazeColorCssOptions {
|
|
|
656
1069
|
* `name: 'brand'` → `--brand-color: …`.
|
|
657
1070
|
*/
|
|
658
1071
|
name: string;
|
|
659
|
-
/** Output color format. Default: '
|
|
1072
|
+
/** Output color format. Default: 'oklch'. */
|
|
660
1073
|
format?: GlazeColorFormat;
|
|
661
1074
|
/**
|
|
662
1075
|
* Suffix appended to the name. Default: '-color' (matches
|
|
663
1076
|
* `theme.css` default).
|
|
664
1077
|
*/
|
|
665
1078
|
suffix?: string;
|
|
1079
|
+
/**
|
|
1080
|
+
* Emit hue as a separate `--{name}-hue` custom property, referenced via
|
|
1081
|
+
* `var()`. Requires `format: 'oklch'` (any other format throws) and a
|
|
1082
|
+
* pastel token.
|
|
1083
|
+
*/
|
|
1084
|
+
splitHue?: boolean;
|
|
666
1085
|
}
|
|
667
1086
|
/** Return type for `glaze.color()`. */
|
|
668
1087
|
interface GlazeColorToken {
|
|
@@ -672,7 +1091,7 @@ interface GlazeColorToken {
|
|
|
672
1091
|
token(options?: GlazeTokenOptions): Record<string, string>;
|
|
673
1092
|
/**
|
|
674
1093
|
* Export as a tasty style-to-state binding (no color name key).
|
|
675
|
-
* Uses `#name` keys and state aliases (`''`,
|
|
1094
|
+
* Uses `#name` keys and state aliases (`''`, `'@media(prefers-color-scheme: dark)'`, etc.).
|
|
676
1095
|
* @see https://tasty.style/docs
|
|
677
1096
|
*/
|
|
678
1097
|
tasty(options?: GlazeTokenOptions): Record<string, string>;
|
|
@@ -680,18 +1099,42 @@ interface GlazeColorToken {
|
|
|
680
1099
|
json(options?: GlazeJsonOptions): Record<string, string>;
|
|
681
1100
|
/** Export as CSS custom property declarations grouped by scheme variant. */
|
|
682
1101
|
css(options: GlazeColorCssOptions): GlazeCssResult;
|
|
1102
|
+
/**
|
|
1103
|
+
* Export as W3C DTCG color tokens (one per scheme variant, no color name
|
|
1104
|
+
* key). Each entry is a full `{ $type: 'color', $value }` token.
|
|
1105
|
+
* @see https://www.designtokens.org/
|
|
1106
|
+
*/
|
|
1107
|
+
dtcg(options?: GlazeDtcgOptions): GlazeColorDtcgResult;
|
|
1108
|
+
/**
|
|
1109
|
+
* Export as a single W3C DTCG Resolver-Module document for this color,
|
|
1110
|
+
* keyed by `name` across all scheme variants. `name` is required.
|
|
1111
|
+
* @see https://www.designtokens.org/
|
|
1112
|
+
*/
|
|
1113
|
+
dtcgResolver(options: GlazeColorDtcgResolverOptions): GlazeDtcgResolverDocument;
|
|
1114
|
+
/**
|
|
1115
|
+
* Export as a Tailwind CSS v4 `@theme` block (light baseline) plus dark /
|
|
1116
|
+
* high-contrast overrides. Returns a single ready-to-paste CSS string.
|
|
1117
|
+
* `name` is required (forms `--color-<name>`).
|
|
1118
|
+
* @see https://tailwindcss.com/docs/theme
|
|
1119
|
+
*/
|
|
1120
|
+
tailwind(options: GlazeColorTailwindOptions): string;
|
|
683
1121
|
/**
|
|
684
1122
|
* Serialize the token as a JSON-safe object. Captures the original
|
|
685
1123
|
* input value, overrides, and config so it can be rehydrated via
|
|
686
1124
|
* `glaze.colorFrom(...)`. `base` is recursively serialized.
|
|
1125
|
+
* Optional `override` is merged over the instance local at export time.
|
|
687
1126
|
*/
|
|
688
|
-
export(): GlazeColorTokenExport;
|
|
1127
|
+
export(override?: GlazeConfigOverride): GlazeColorTokenExport;
|
|
689
1128
|
}
|
|
690
1129
|
/**
|
|
691
1130
|
* JSON-safe serialization of a `glaze.color()` token. Pass to
|
|
692
1131
|
* `glaze.colorFrom(...)` to rehydrate.
|
|
693
1132
|
*/
|
|
694
1133
|
interface GlazeColorTokenExport {
|
|
1134
|
+
/** Snapshot kind. Always written by `token.export()`; optional on legacy snapshots. */
|
|
1135
|
+
kind?: 'color';
|
|
1136
|
+
/** Schema version. Always written by `token.export()`; optional on legacy snapshots. */
|
|
1137
|
+
version?: number;
|
|
695
1138
|
/**
|
|
696
1139
|
* Discriminator for the source overload that created the token.
|
|
697
1140
|
* - `'value'`: created via `glaze.color(value)` or `glaze.color({ from, ...overrides })`.
|
|
@@ -706,14 +1149,26 @@ interface GlazeColorTokenExport {
|
|
|
706
1149
|
*/
|
|
707
1150
|
overrides?: GlazeColorOverridesExport;
|
|
708
1151
|
/**
|
|
709
|
-
* Effective config
|
|
710
|
-
*
|
|
711
|
-
*
|
|
712
|
-
* post-merge defaults are present. Used by `glaze.colorFrom()` to
|
|
713
|
-
* reproduce deterministic behavior across `configure()` calls.
|
|
1152
|
+
* Effective config freeze from `.export()` — `getConfig() ∪ local ∪
|
|
1153
|
+
* exportArg` at call time. Used by `glaze.colorFrom()` to pin
|
|
1154
|
+
* deterministic behavior across later `configure()` calls.
|
|
714
1155
|
*/
|
|
715
1156
|
config?: GlazeConfigOverride;
|
|
716
1157
|
}
|
|
1158
|
+
/**
|
|
1159
|
+
* JSON-safe serialization of a `glaze.palette()` composition.
|
|
1160
|
+
* Pass to `glaze.paletteFrom(...)` to rehydrate.
|
|
1161
|
+
*/
|
|
1162
|
+
interface GlazePaletteExport {
|
|
1163
|
+
/** Snapshot kind. Always written by `palette.export()`. */
|
|
1164
|
+
kind?: 'palette';
|
|
1165
|
+
/** Schema version. Always written by `palette.export()`. */
|
|
1166
|
+
version?: number;
|
|
1167
|
+
/** Per-theme authoring snapshots keyed by theme name. */
|
|
1168
|
+
themes: Record<string, GlazeThemeExport>;
|
|
1169
|
+
/** Primary theme name, if set on the palette. */
|
|
1170
|
+
primary?: string;
|
|
1171
|
+
}
|
|
717
1172
|
/**
|
|
718
1173
|
* Serializable shape of a structured `glaze.color({...})` input.
|
|
719
1174
|
* Differs from `GlazeColorInput` only in that `base` is replaced by an
|
|
@@ -724,13 +1179,17 @@ interface GlazeColorInputExport {
|
|
|
724
1179
|
saturation: number;
|
|
725
1180
|
tone: HCPair<number | ExtremeValue>;
|
|
726
1181
|
saturationFactor?: number;
|
|
1182
|
+
darkHue?: number | RelativeValue;
|
|
1183
|
+
darkSaturation?: number;
|
|
1184
|
+
darkSaturationFactor?: number;
|
|
727
1185
|
mode?: AdaptationMode;
|
|
728
|
-
|
|
1186
|
+
autoFlip?: boolean;
|
|
729
1187
|
opacity?: number;
|
|
730
1188
|
base?: GlazeColorTokenExport | GlazeColorValue;
|
|
731
1189
|
contrast?: HCPair<ContrastSpec>;
|
|
732
1190
|
name?: string;
|
|
733
1191
|
pastel?: boolean;
|
|
1192
|
+
role?: RoleInput;
|
|
734
1193
|
}
|
|
735
1194
|
/**
|
|
736
1195
|
* Serializable shape of `GlazeColorOverrides`. `base` is replaced by
|
|
@@ -739,21 +1198,47 @@ interface GlazeColorInputExport {
|
|
|
739
1198
|
interface GlazeColorOverridesExport {
|
|
740
1199
|
hue?: number | RelativeValue;
|
|
741
1200
|
saturation?: number;
|
|
1201
|
+
darkHue?: number | RelativeValue;
|
|
1202
|
+
darkSaturation?: number;
|
|
1203
|
+
darkSaturationFactor?: number;
|
|
742
1204
|
tone?: HCPair<ToneValue>;
|
|
743
1205
|
saturationFactor?: number;
|
|
744
1206
|
mode?: AdaptationMode;
|
|
745
|
-
|
|
1207
|
+
autoFlip?: boolean;
|
|
746
1208
|
contrast?: HCPair<ContrastSpec>;
|
|
747
1209
|
base?: GlazeColorTokenExport | GlazeColorValue;
|
|
748
1210
|
opacity?: number;
|
|
749
1211
|
name?: string;
|
|
750
1212
|
pastel?: boolean;
|
|
1213
|
+
role?: RoleInput;
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* The hue/saturation seed pair a theme resolves against.
|
|
1217
|
+
*
|
|
1218
|
+
* `darkHue` / `darkSaturation` are a separate seed for the `dark` and
|
|
1219
|
+
* `darkContrast` variants; each falls back to its light counterpart. Setting
|
|
1220
|
+
* `darkSaturation` opts the theme out of the global `darkDesaturation`
|
|
1221
|
+
* reduction — the authored value is used literally.
|
|
1222
|
+
*/
|
|
1223
|
+
interface GlazeThemeSeed {
|
|
1224
|
+
/** Light-scheme hue seed (0–360). */
|
|
1225
|
+
hue: number;
|
|
1226
|
+
/** Light-scheme saturation seed (0–100). */
|
|
1227
|
+
saturation: number;
|
|
1228
|
+
/** Dark-scheme hue seed (0–360). Defaults to `hue`. */
|
|
1229
|
+
darkHue?: number;
|
|
1230
|
+
/** Dark-scheme saturation seed (0–100). Defaults to `saturation`. */
|
|
1231
|
+
darkSaturation?: number;
|
|
751
1232
|
}
|
|
752
1233
|
interface GlazeTheme {
|
|
753
1234
|
/** The hue seed (0–360). */
|
|
754
1235
|
readonly hue: number;
|
|
755
1236
|
/** The saturation seed (0–100). */
|
|
756
1237
|
readonly saturation: number;
|
|
1238
|
+
/** The dark-scheme hue seed (0–360), or `undefined` when `hue` is reused. */
|
|
1239
|
+
readonly darkHue: number | undefined;
|
|
1240
|
+
/** The dark-scheme saturation seed (0–100), or `undefined` when `saturation` is reused. */
|
|
1241
|
+
readonly darkSaturation: number | undefined;
|
|
757
1242
|
/** The effective config for this theme. */
|
|
758
1243
|
getConfig(): GlazeConfigResolved;
|
|
759
1244
|
/** Add/replace colors (additive merge with existing definitions). */
|
|
@@ -771,7 +1256,7 @@ interface GlazeTheme {
|
|
|
771
1256
|
/** Clear all color definitions. */
|
|
772
1257
|
reset(): void;
|
|
773
1258
|
/** Export the theme configuration as a JSON-safe object. */
|
|
774
|
-
export(): GlazeThemeExport;
|
|
1259
|
+
export(override?: GlazeConfigOverride): GlazeThemeExport;
|
|
775
1260
|
/** Create a child theme inheriting all color definitions. */
|
|
776
1261
|
extend(options: GlazeExtendOptions): GlazeTheme;
|
|
777
1262
|
/** Resolve all colors and return the result map. */
|
|
@@ -787,26 +1272,53 @@ interface GlazeTheme {
|
|
|
787
1272
|
tokens(options?: GlazeJsonOptions): Record<string, Record<string, string>>;
|
|
788
1273
|
/**
|
|
789
1274
|
* Export as tasty style-to-state bindings.
|
|
790
|
-
* Uses `#name` color token keys and state aliases (`''`,
|
|
1275
|
+
* Uses `#name` color token keys and state aliases (`''`, `'@media(prefers-color-scheme: dark)'`, etc.).
|
|
791
1276
|
* Spread into component styles or register as a recipe via `configure({ recipes })`.
|
|
792
1277
|
* @see https://tasty.style/docs
|
|
793
1278
|
*/
|
|
794
|
-
tasty(options?:
|
|
1279
|
+
tasty(options?: GlazeTastyOptions): Record<string, Record<string, string>>;
|
|
795
1280
|
/** Export as plain JSON. */
|
|
796
1281
|
json(options?: GlazeJsonOptions): Record<string, Record<string, string>>;
|
|
797
1282
|
/** Export as CSS custom property declarations. */
|
|
798
1283
|
css(options?: GlazeCssOptions): GlazeCssResult;
|
|
1284
|
+
/**
|
|
1285
|
+
* Export as W3C Design Tokens Format Module (2025.10) documents, one per
|
|
1286
|
+
* scheme variant. Consumable by Figma, Tokens Studio, Style Dictionary,
|
|
1287
|
+
* Terrazzo, and any DTCG-compatible tool.
|
|
1288
|
+
* @see https://www.designtokens.org/
|
|
1289
|
+
*/
|
|
1290
|
+
dtcg(options?: GlazeDtcgOptions): GlazeDtcgResult;
|
|
1291
|
+
/**
|
|
1292
|
+
* Export as a single W3C DTCG Resolver-Module document describing every
|
|
1293
|
+
* scheme variant as one `sets` entry plus a single `scheme` modifier with a
|
|
1294
|
+
* context per variant. Consumable by resolver tools such as Dispersa.
|
|
1295
|
+
* @see https://www.designtokens.org/
|
|
1296
|
+
*/
|
|
1297
|
+
dtcgResolver(options?: GlazeDtcgResolverOptions): GlazeDtcgResolverDocument;
|
|
1298
|
+
/**
|
|
1299
|
+
* Export as a Tailwind CSS v4 `@theme` block (light baseline) plus dark /
|
|
1300
|
+
* high-contrast overrides under configurable selectors. Returns a single
|
|
1301
|
+
* ready-to-paste CSS string.
|
|
1302
|
+
* @see https://tailwindcss.com/docs/theme
|
|
1303
|
+
*/
|
|
1304
|
+
tailwind(options?: GlazeTailwindOptions): string;
|
|
799
1305
|
}
|
|
800
1306
|
interface GlazeExtendOptions {
|
|
801
1307
|
hue?: number;
|
|
802
1308
|
saturation?: number;
|
|
1309
|
+
/** Replace the dark-scheme hue seed (0–360). Defaults to the parent's. */
|
|
1310
|
+
darkHue?: number;
|
|
1311
|
+
/** Replace the dark-scheme saturation seed (0–100). Defaults to the parent's. */
|
|
1312
|
+
darkSaturation?: number;
|
|
803
1313
|
colors?: ColorMap;
|
|
804
1314
|
/** Config override for the child theme. Merged with the parent's override. */
|
|
805
1315
|
config?: GlazeConfigOverride;
|
|
806
1316
|
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Options for `token.token()` / `token.tasty()`, and the base of the theme and
|
|
1319
|
+
* palette `tasty()` options: output format, scheme variants, state aliases.
|
|
1320
|
+
*/
|
|
807
1321
|
interface GlazeTokenOptions {
|
|
808
|
-
/** Prefix mode. `true` uses "<themeName>-", or provide a custom map. */
|
|
809
|
-
prefix?: boolean | Record<string, string>;
|
|
810
1322
|
/** Override state aliases for this export. */
|
|
811
1323
|
states?: {
|
|
812
1324
|
dark?: string;
|
|
@@ -814,20 +1326,47 @@ interface GlazeTokenOptions {
|
|
|
814
1326
|
};
|
|
815
1327
|
/** Override which scheme variants to include. */
|
|
816
1328
|
modes?: GlazeOutputModes;
|
|
817
|
-
/** Output color format. Default: '
|
|
1329
|
+
/** Output color format. Default: 'oklch'. */
|
|
818
1330
|
format?: GlazeColorFormat;
|
|
819
1331
|
}
|
|
1332
|
+
/** Options for `theme.tasty()`. */
|
|
1333
|
+
interface GlazeTastyOptions extends GlazeTokenOptions {
|
|
1334
|
+
/**
|
|
1335
|
+
* Emit hue as a separate custom property, referenced via `var()`.
|
|
1336
|
+
* Requires `format: 'oklch'` (any other format throws) and every color to
|
|
1337
|
+
* be pastel.
|
|
1338
|
+
*/
|
|
1339
|
+
splitHue?: boolean;
|
|
1340
|
+
/**
|
|
1341
|
+
* Base name for the theme-level hue var (`--{name}-hue`). Default: `'theme'`.
|
|
1342
|
+
* Must not equal the name of a color that sets its own hue (throws).
|
|
1343
|
+
*/
|
|
1344
|
+
name?: string;
|
|
1345
|
+
}
|
|
1346
|
+
/** Options for `theme.tokens()` / `theme.json()` and their palette and token counterparts. */
|
|
820
1347
|
interface GlazeJsonOptions {
|
|
821
1348
|
/** Override which scheme variants to include. */
|
|
822
1349
|
modes?: GlazeOutputModes;
|
|
823
|
-
/** Output color format. Default: '
|
|
1350
|
+
/** Output color format. Default: 'oklch'. */
|
|
824
1351
|
format?: GlazeColorFormat;
|
|
825
1352
|
}
|
|
1353
|
+
/** Options for `theme.css()`. */
|
|
826
1354
|
interface GlazeCssOptions {
|
|
827
|
-
/** Output color format. Default: '
|
|
1355
|
+
/** Output color format. Default: 'oklch'. */
|
|
828
1356
|
format?: GlazeColorFormat;
|
|
829
1357
|
/** Suffix appended to each CSS custom property name. Default: '-color'. */
|
|
830
1358
|
suffix?: string;
|
|
1359
|
+
/**
|
|
1360
|
+
* Emit hue as a separate custom property, referenced via `var()`.
|
|
1361
|
+
* Requires `format: 'oklch'` (any other format throws) and every color to
|
|
1362
|
+
* be pastel.
|
|
1363
|
+
*/
|
|
1364
|
+
splitHue?: boolean;
|
|
1365
|
+
/**
|
|
1366
|
+
* Base name for the theme-level hue var (`--{name}-hue`). Default: `'theme'`.
|
|
1367
|
+
* Must not equal the name of a color that sets its own hue (throws).
|
|
1368
|
+
*/
|
|
1369
|
+
name?: string;
|
|
831
1370
|
}
|
|
832
1371
|
/** CSS custom property declarations grouped by scheme variant. */
|
|
833
1372
|
interface GlazeCssResult {
|
|
@@ -836,6 +1375,182 @@ interface GlazeCssResult {
|
|
|
836
1375
|
lightContrast: string;
|
|
837
1376
|
darkContrast: string;
|
|
838
1377
|
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Color space used for DTCG `$value` color objects.
|
|
1380
|
+
* @see https://www.designtokens.org/
|
|
1381
|
+
*/
|
|
1382
|
+
type DtcgColorSpace = 'srgb' | 'oklch';
|
|
1383
|
+
/**
|
|
1384
|
+
* A DTCG color `$value` in the sRGB color space: gamma sRGB components in
|
|
1385
|
+
* 0–1 plus a 6-digit `hex` hint. Universally understood by Figma, Tokens
|
|
1386
|
+
* Studio, Style Dictionary, and every DTCG reader.
|
|
1387
|
+
*/
|
|
1388
|
+
interface DtcgSrgbColorValue {
|
|
1389
|
+
colorSpace: 'srgb';
|
|
1390
|
+
components: [number, number, number];
|
|
1391
|
+
hex: HexColor;
|
|
1392
|
+
/** Opacity 0–1. Omitted when fully opaque (alpha = 1). */
|
|
1393
|
+
alpha?: number;
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* A DTCG color `$value` in the OKLCH color space: `[L, C, H]` components
|
|
1397
|
+
* (L/C: 0–1, H: degrees). Wide-gamut and Glaze-native; no `hex` is emitted.
|
|
1398
|
+
*/
|
|
1399
|
+
interface DtcgOklchColorValue {
|
|
1400
|
+
colorSpace: 'oklch';
|
|
1401
|
+
components: [number, number, number];
|
|
1402
|
+
/** Opacity 0–1. Omitted when fully opaque (alpha = 1). */
|
|
1403
|
+
alpha?: number;
|
|
1404
|
+
}
|
|
1405
|
+
/** A DTCG `$value` for a color token, in either supported color space. */
|
|
1406
|
+
type DtcgColorValue = DtcgSrgbColorValue | DtcgOklchColorValue;
|
|
1407
|
+
/**
|
|
1408
|
+
* A single W3C DTCG color token: `{ $type: 'color', $value }`.
|
|
1409
|
+
* `$description` is optional and not populated by Glaze today.
|
|
1410
|
+
*/
|
|
1411
|
+
interface DtcgColorToken {
|
|
1412
|
+
$type: 'color';
|
|
1413
|
+
$value: DtcgColorValue;
|
|
1414
|
+
$description?: string;
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* A W3C Design Tokens Format Module (2025.10) token tree for one scheme.
|
|
1418
|
+
* Glaze emits one document per scheme variant — the most tool-compatible
|
|
1419
|
+
* convention (one file per Style Dictionary theme / Tokens Studio set /
|
|
1420
|
+
* Figma variable mode).
|
|
1421
|
+
*/
|
|
1422
|
+
type DtcgDocument = Record<string, DtcgColorToken>;
|
|
1423
|
+
/** DTCG token documents grouped by scheme variant. Light is always present. */
|
|
1424
|
+
interface GlazeDtcgResult {
|
|
1425
|
+
light: DtcgDocument;
|
|
1426
|
+
dark?: DtcgDocument;
|
|
1427
|
+
lightContrast?: DtcgDocument;
|
|
1428
|
+
darkContrast?: DtcgDocument;
|
|
1429
|
+
}
|
|
1430
|
+
/** A single DTCG color token grouped by scheme variant (standalone tokens). */
|
|
1431
|
+
interface GlazeColorDtcgResult {
|
|
1432
|
+
light: DtcgColorToken;
|
|
1433
|
+
dark?: DtcgColorToken;
|
|
1434
|
+
lightContrast?: DtcgColorToken;
|
|
1435
|
+
darkContrast?: DtcgColorToken;
|
|
1436
|
+
}
|
|
1437
|
+
/** Options for `theme.dtcg()` / `palette.dtcg()`. */
|
|
1438
|
+
interface GlazeDtcgOptions {
|
|
1439
|
+
/** Override which scheme variants to include. */
|
|
1440
|
+
modes?: GlazeOutputModes;
|
|
1441
|
+
/**
|
|
1442
|
+
* DTCG color space. `'srgb'` (default) emits sRGB components plus a `hex`
|
|
1443
|
+
* hint — universally understood (Figma, Tokens Studio). `'oklch'` emits
|
|
1444
|
+
* OKLCH components with no hex — Glaze-native, wide-gamut.
|
|
1445
|
+
*/
|
|
1446
|
+
colorSpace?: DtcgColorSpace;
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* A node in a DTCG Resolver-Module token tree: either a leaf color token or a
|
|
1450
|
+
* nested group. A flat `DtcgDocument` (top-level color-name keys) is a valid
|
|
1451
|
+
* shallow tree, so Glaze's per-scheme documents slot directly into
|
|
1452
|
+
* `sets.<name>.sources` and `modifiers.<name>.contexts.<ctx>` entries.
|
|
1453
|
+
*/
|
|
1454
|
+
interface DtcgTokenTree {
|
|
1455
|
+
[key: string]: DtcgColorToken | DtcgTokenTree;
|
|
1456
|
+
}
|
|
1457
|
+
/** A named set in a resolver document: a list of token-tree sources. */
|
|
1458
|
+
interface DtcgResolverSet {
|
|
1459
|
+
sources: DtcgTokenTree[];
|
|
1460
|
+
}
|
|
1461
|
+
/**
|
|
1462
|
+
* A named modifier (an axis such as `scheme`) in a resolver document.
|
|
1463
|
+
* `default` names the context applied when no override is selected; `contexts`
|
|
1464
|
+
* maps each context name to the token-tree overrides applied for it.
|
|
1465
|
+
*/
|
|
1466
|
+
interface DtcgResolverModifier {
|
|
1467
|
+
default: string;
|
|
1468
|
+
contexts: Record<string, DtcgTokenTree[]>;
|
|
1469
|
+
}
|
|
1470
|
+
/** A JSON-pointer `$ref` entry in a resolver document's `resolutionOrder`. */
|
|
1471
|
+
interface DtcgResolverRef {
|
|
1472
|
+
$ref: string;
|
|
1473
|
+
}
|
|
1474
|
+
/**
|
|
1475
|
+
* A W3C DTCG Resolver-Module document. Describes every scheme variant in a
|
|
1476
|
+
* single file as `sets` (base token sources) plus `modifiers` (per-context
|
|
1477
|
+
* overrides) composed in `resolutionOrder`. Consumable by resolver tools such
|
|
1478
|
+
* as Dispersa.
|
|
1479
|
+
* @see https://www.designtokens.org/
|
|
1480
|
+
*/
|
|
1481
|
+
interface GlazeDtcgResolverDocument {
|
|
1482
|
+
version: string;
|
|
1483
|
+
sets: Record<string, DtcgResolverSet>;
|
|
1484
|
+
modifiers: Record<string, DtcgResolverModifier>;
|
|
1485
|
+
resolutionOrder: DtcgResolverRef[];
|
|
1486
|
+
}
|
|
1487
|
+
/** Renaming of the four scheme variants as resolver-modifier context names. */
|
|
1488
|
+
interface GlazeDtcgResolverContextNames {
|
|
1489
|
+
light?: string;
|
|
1490
|
+
dark?: string;
|
|
1491
|
+
lightContrast?: string;
|
|
1492
|
+
darkContrast?: string;
|
|
1493
|
+
}
|
|
1494
|
+
/**
|
|
1495
|
+
* Options for `theme.dtcgResolver()` / `palette.dtcgResolver()`. Extends
|
|
1496
|
+
* `GlazeDtcgOptions` so `modes` + `colorSpace` pass through to the underlying
|
|
1497
|
+
* per-scheme `dtcg()` build.
|
|
1498
|
+
*/
|
|
1499
|
+
interface GlazeDtcgResolverOptions extends GlazeDtcgOptions {
|
|
1500
|
+
/** Name of the single set holding the default (light) token tree. Default `'base'`. */
|
|
1501
|
+
setName?: string;
|
|
1502
|
+
/**
|
|
1503
|
+
* Name of the modifier describing the scheme axis. Default `'scheme'`
|
|
1504
|
+
* (Glaze's term for the light / dark / high-contrast axis).
|
|
1505
|
+
*/
|
|
1506
|
+
modifierName?: string;
|
|
1507
|
+
/**
|
|
1508
|
+
* Override the four context names emitted on the modifier. Defaults to the
|
|
1509
|
+
* Glaze variant keys: `light` / `dark` / `lightContrast` / `darkContrast`.
|
|
1510
|
+
*/
|
|
1511
|
+
contextNames?: GlazeDtcgResolverContextNames;
|
|
1512
|
+
/** Resolver document version. Default `'2025.10'`. */
|
|
1513
|
+
version?: string;
|
|
1514
|
+
}
|
|
1515
|
+
/** Options for `glaze.color().dtcgResolver()`. `name` is required. */
|
|
1516
|
+
interface GlazeColorDtcgResolverOptions extends GlazeDtcgResolverOptions {
|
|
1517
|
+
/** Token name keying the color within each token tree. Required. */
|
|
1518
|
+
name: string;
|
|
1519
|
+
}
|
|
1520
|
+
/** Options for `theme.tailwind()` / `palette.tailwind()`. */
|
|
1521
|
+
interface GlazeTailwindOptions {
|
|
1522
|
+
/** Override which scheme variants to include. */
|
|
1523
|
+
modes?: GlazeOutputModes;
|
|
1524
|
+
/** Output color format. Default: 'oklch'. */
|
|
1525
|
+
format?: GlazeColorFormat;
|
|
1526
|
+
/**
|
|
1527
|
+
* CSS custom property namespace, forming `--<namespace><name>`.
|
|
1528
|
+
* Default: `'color-'` → `--color-surface`. (Tailwind v4's `--color-*`
|
|
1529
|
+
* convention, which auto-generates `bg-*` / `text-*` / `border-*`.)
|
|
1530
|
+
*
|
|
1531
|
+
* Named `namespace` rather than `prefix` to avoid clashing with the
|
|
1532
|
+
* palette theme-prefix option on `palette.tailwind()`.
|
|
1533
|
+
*/
|
|
1534
|
+
namespace?: string;
|
|
1535
|
+
/**
|
|
1536
|
+
* Selector wrapping the dark-scheme overrides. Default: `'.dark'`.
|
|
1537
|
+
* Pass a media query such as `'@media (prefers-color-scheme: dark)'` to
|
|
1538
|
+
* drive dark mode from the OS preference instead of a class.
|
|
1539
|
+
*/
|
|
1540
|
+
darkSelector?: string;
|
|
1541
|
+
/**
|
|
1542
|
+
* Selector wrapping the light high-contrast overrides. Default:
|
|
1543
|
+
* `'.high-contrast'`. The combined dark + high-contrast overrides are
|
|
1544
|
+
* emitted under `${darkSelector}${highContrastSelector}` (e.g.
|
|
1545
|
+
* `.dark.high-contrast`).
|
|
1546
|
+
*/
|
|
1547
|
+
highContrastSelector?: string;
|
|
1548
|
+
}
|
|
1549
|
+
/** Options for `glaze.color().tailwind()`. `name` is required. */
|
|
1550
|
+
interface GlazeColorTailwindOptions extends GlazeTailwindOptions {
|
|
1551
|
+
/** Custom property base name (without leading `--`). Required. */
|
|
1552
|
+
name: string;
|
|
1553
|
+
}
|
|
839
1554
|
/** Options for `glaze.palette()` creation. */
|
|
840
1555
|
interface GlazePaletteOptions {
|
|
841
1556
|
/**
|
|
@@ -852,7 +1567,10 @@ interface GlazePaletteOptions {
|
|
|
852
1567
|
*/
|
|
853
1568
|
primary?: string;
|
|
854
1569
|
}
|
|
855
|
-
/**
|
|
1570
|
+
/**
|
|
1571
|
+
* Options shared by every palette export except `json()`: `tokens()`,
|
|
1572
|
+
* `tasty()`, `css()`, `dtcg()`, `dtcgResolver()`, and `tailwind()`.
|
|
1573
|
+
*/
|
|
856
1574
|
interface GlazePaletteExportOptions {
|
|
857
1575
|
/**
|
|
858
1576
|
* Prefix mode. `true` uses `"<themeName>-"`, or provide a custom map.
|
|
@@ -868,7 +1586,53 @@ interface GlazePaletteExportOptions {
|
|
|
868
1586
|
*/
|
|
869
1587
|
primary?: string | false;
|
|
870
1588
|
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Options for `palette.tasty()`. There is no `name`: each theme's hue var is
|
|
1591
|
+
* named after the theme.
|
|
1592
|
+
*/
|
|
1593
|
+
interface GlazePaletteTastyOptions extends GlazeTokenOptions, GlazePaletteExportOptions {
|
|
1594
|
+
/**
|
|
1595
|
+
* Emit hue as a separate custom property, referenced via `var()`.
|
|
1596
|
+
* Requires `format: 'oklch'` (any other format throws) and every color to
|
|
1597
|
+
* be pastel. The theme-level hue var is `--{themeName}-hue`.
|
|
1598
|
+
*/
|
|
1599
|
+
splitHue?: boolean;
|
|
1600
|
+
}
|
|
1601
|
+
/**
|
|
1602
|
+
* Options for `palette.css()`. There is no `name`: each theme's hue var is
|
|
1603
|
+
* named after the theme.
|
|
1604
|
+
*/
|
|
1605
|
+
interface GlazePaletteCssOptions extends GlazePaletteExportOptions {
|
|
1606
|
+
/** Output color format. Default: 'oklch'. */
|
|
1607
|
+
format?: GlazeColorFormat;
|
|
1608
|
+
/** Suffix appended to each CSS custom property name. Default: '-color'. */
|
|
1609
|
+
suffix?: string;
|
|
1610
|
+
/**
|
|
1611
|
+
* Emit hue as a separate custom property, referenced via `var()`.
|
|
1612
|
+
* Requires `format: 'oklch'` (any other format throws) and every color to
|
|
1613
|
+
* be pastel. The theme-level hue var is `--{themeName}-hue`.
|
|
1614
|
+
*/
|
|
1615
|
+
splitHue?: boolean;
|
|
1616
|
+
}
|
|
871
1617
|
interface GlazePalette {
|
|
1618
|
+
/** Theme names in insertion order. */
|
|
1619
|
+
list(): string[];
|
|
1620
|
+
/** Primary theme name, if set at palette creation. */
|
|
1621
|
+
readonly primary: string | undefined;
|
|
1622
|
+
/** Get a theme by name. Returns the live instance held by the palette. */
|
|
1623
|
+
theme(name: string): GlazeTheme | undefined;
|
|
1624
|
+
/**
|
|
1625
|
+
* Shallow copy of the theme map (same instances the palette holds).
|
|
1626
|
+
* Mutating a returned theme affects subsequent palette exports.
|
|
1627
|
+
*/
|
|
1628
|
+
themes(): Record<string, GlazeTheme>;
|
|
1629
|
+
/**
|
|
1630
|
+
* Export the palette authoring configuration as a JSON-safe object.
|
|
1631
|
+
* Restorable via `glaze.paletteFrom(...)`. Distinct from `json()`, which
|
|
1632
|
+
* emits resolved color strings. Optional `override` is forwarded to each
|
|
1633
|
+
* nested `theme.export(override)`.
|
|
1634
|
+
*/
|
|
1635
|
+
export(override?: GlazeConfigOverride): GlazePaletteExport;
|
|
872
1636
|
/**
|
|
873
1637
|
* Export all themes as a flat token map grouped by scheme variant.
|
|
874
1638
|
* Prefix defaults to `true` — all tokens are prefixed with the theme name.
|
|
@@ -883,19 +1647,47 @@ interface GlazePalette {
|
|
|
883
1647
|
tokens(options?: GlazeJsonOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
|
|
884
1648
|
/**
|
|
885
1649
|
* Export all themes as tasty style-to-state bindings.
|
|
886
|
-
* Uses `#name` color token keys and state aliases (`''`,
|
|
1650
|
+
* Uses `#name` color token keys and state aliases (`''`, `'@media(prefers-color-scheme: dark)'`, etc.).
|
|
887
1651
|
* Prefix defaults to `true`. Inherits the palette-level `primary`.
|
|
888
1652
|
* @see https://tasty.style/docs
|
|
889
1653
|
*/
|
|
890
|
-
tasty(options?:
|
|
891
|
-
/**
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
1654
|
+
tasty(options?: GlazePaletteTastyOptions): Record<string, Record<string, string>>;
|
|
1655
|
+
/**
|
|
1656
|
+
* Export all themes as plain JSON grouped by theme name. No prefix, primary
|
|
1657
|
+
* alias, or collision handling: each theme keeps its own key.
|
|
1658
|
+
*/
|
|
1659
|
+
json(options?: GlazeJsonOptions): Record<string, Record<string, Record<string, string>>>;
|
|
895
1660
|
/** Export all themes as CSS custom property declarations. */
|
|
896
|
-
css(options?:
|
|
1661
|
+
css(options?: GlazePaletteCssOptions): GlazeCssResult;
|
|
1662
|
+
/**
|
|
1663
|
+
* Export all themes as W3C DTCG documents, one per scheme variant.
|
|
1664
|
+
* Prefix defaults to `true`. Inherits the palette-level `primary`.
|
|
1665
|
+
* @see https://www.designtokens.org/
|
|
1666
|
+
*/
|
|
1667
|
+
dtcg(options?: GlazeDtcgOptions & GlazePaletteExportOptions): GlazeDtcgResult;
|
|
1668
|
+
/**
|
|
1669
|
+
* Export all themes as a single W3C DTCG Resolver-Module document. Prefix
|
|
1670
|
+
* defaults to `true`. Inherits the palette-level `primary`.
|
|
1671
|
+
* @see https://www.designtokens.org/
|
|
1672
|
+
*/
|
|
1673
|
+
dtcgResolver(options?: GlazeDtcgResolverOptions & GlazePaletteExportOptions): GlazeDtcgResolverDocument;
|
|
1674
|
+
/**
|
|
1675
|
+
* Export all themes as a Tailwind CSS v4 `@theme` block plus dark /
|
|
1676
|
+
* high-contrast overrides. Returns a single ready-to-paste CSS string.
|
|
1677
|
+
* Prefix defaults to `true`.
|
|
1678
|
+
* @see https://tailwindcss.com/docs/theme
|
|
1679
|
+
*/
|
|
1680
|
+
tailwind(options?: GlazeTailwindOptions & GlazePaletteExportOptions): string;
|
|
897
1681
|
}
|
|
898
1682
|
//#endregion
|
|
1683
|
+
//#region src/serialize.d.ts
|
|
1684
|
+
/** Type guard for theme authoring snapshots (prefers `kind`, falls back to shape). */
|
|
1685
|
+
declare function isThemeExport(data: unknown): data is GlazeThemeExport;
|
|
1686
|
+
/** Type guard for color-token authoring snapshots. */
|
|
1687
|
+
declare function isColorTokenExport(data: unknown): data is GlazeColorTokenExport;
|
|
1688
|
+
/** Type guard for palette authoring snapshots. */
|
|
1689
|
+
declare function isPaletteExport(data: unknown): data is GlazePaletteExport;
|
|
1690
|
+
//#endregion
|
|
899
1691
|
//#region src/glaze.d.ts
|
|
900
1692
|
type PaletteInput = Record<string, GlazeTheme>;
|
|
901
1693
|
/**
|
|
@@ -907,33 +1699,128 @@ type PaletteInput = Record<string, GlazeTheme>;
|
|
|
907
1699
|
* the theme still reacts to later `configure()` calls for fields it
|
|
908
1700
|
* didn't override.
|
|
909
1701
|
*
|
|
1702
|
+
* The object form also accepts `darkHue` / `darkSaturation` — a separate
|
|
1703
|
+
* seed pair for the dark and dark-high-contrast schemes. Both default to
|
|
1704
|
+
* their light counterparts, and an explicit `darkSaturation` opts the theme
|
|
1705
|
+
* out of the global `darkDesaturation` reduction.
|
|
1706
|
+
*
|
|
910
1707
|
* @example
|
|
911
1708
|
* ```ts
|
|
912
1709
|
* const primary = glaze(280, 80);
|
|
913
1710
|
* // or shorthand:
|
|
914
1711
|
* const primary = glaze({ hue: 280, saturation: 80 });
|
|
1712
|
+
* // with a retuned dark seed:
|
|
1713
|
+
* const primary = glaze({ hue: 280, saturation: 80, darkHue: 268, darkSaturation: 65 });
|
|
915
1714
|
* // with config override:
|
|
916
1715
|
* const raw = glaze(280, 80, { lightTone: false });
|
|
1716
|
+
* const rawSeed = glaze({ hue: 280, saturation: 80 }, { lightTone: false });
|
|
917
1717
|
* ```
|
|
918
1718
|
*/
|
|
919
|
-
declare function glaze(
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
1719
|
+
declare function glaze(hue: number, saturation?: number, config?: GlazeConfigOverride): GlazeTheme;
|
|
1720
|
+
declare function glaze(seed: GlazeThemeSeed, config?: GlazeConfigOverride): GlazeTheme;
|
|
1721
|
+
/** @deprecated Pass the config second: `glaze(seed, config)`. */
|
|
1722
|
+
declare function glaze(seed: GlazeThemeSeed, saturation: undefined, config?: GlazeConfigOverride): GlazeTheme;
|
|
923
1723
|
declare namespace glaze {
|
|
924
1724
|
var configure: (config: GlazeConfig) => void;
|
|
925
1725
|
var palette: (themes: PaletteInput, options?: GlazePaletteOptions) => GlazePalette;
|
|
1726
|
+
var themeFrom: (data: GlazeThemeExport) => GlazeTheme;
|
|
926
1727
|
var from: (data: GlazeThemeExport) => GlazeTheme;
|
|
927
1728
|
var color: (input: GlazeFromInput | GlazeColorInput | GlazeColorValue, config?: GlazeConfigOverride) => GlazeColorToken;
|
|
928
1729
|
var shadow: (input: GlazeShadowInput) => ResolvedColorVariant;
|
|
1730
|
+
var glow: (input: GlazeGlowInput) => ResolvedColorVariant;
|
|
929
1731
|
var format: (variant: ResolvedColorVariant, colorFormat?: GlazeColorFormat, pastel?: boolean) => string;
|
|
930
1732
|
var fromHex: (hex: string) => GlazeTheme;
|
|
931
1733
|
var fromRgb: (r: number, g: number, b: number) => GlazeTheme;
|
|
932
1734
|
var colorFrom: (data: GlazeColorTokenExport) => GlazeColorToken;
|
|
1735
|
+
var paletteFrom: (data: GlazePaletteExport) => GlazePalette;
|
|
1736
|
+
var isThemeExport: typeof isThemeExport;
|
|
1737
|
+
var isColorTokenExport: typeof isColorTokenExport;
|
|
1738
|
+
var isPaletteExport: typeof isPaletteExport;
|
|
933
1739
|
var getConfig: () => GlazeConfigResolved;
|
|
934
1740
|
var resetConfig: () => void;
|
|
935
1741
|
}
|
|
936
1742
|
//#endregion
|
|
1743
|
+
//#region src/channels.d.ts
|
|
1744
|
+
interface HueDeclaration {
|
|
1745
|
+
prop: string;
|
|
1746
|
+
value: string;
|
|
1747
|
+
}
|
|
1748
|
+
interface HuePlan {
|
|
1749
|
+
/** CSS `var()` reference spliced into `oklch(L C <hueVar>)`. */
|
|
1750
|
+
hueVar: string;
|
|
1751
|
+
/** When true, emit a full inline color (shadow/glow/mix/achromatic). */
|
|
1752
|
+
inline: boolean;
|
|
1753
|
+
/** Scheme-independent `--*-hue` declarations for this color. */
|
|
1754
|
+
declarations: HueDeclaration[];
|
|
1755
|
+
}
|
|
1756
|
+
interface ChannelCtx {
|
|
1757
|
+
seedHue: number;
|
|
1758
|
+
/**
|
|
1759
|
+
* Dark-scheme seed hue, when the theme authored one. Drives the dark
|
|
1760
|
+
* `--{baseName}-hue` value; falls back to `seedHue`.
|
|
1761
|
+
*/
|
|
1762
|
+
darkSeedHue?: number;
|
|
1763
|
+
/** Theme-level hue var base name (without `--` / `-hue`). */
|
|
1764
|
+
baseName: string;
|
|
1765
|
+
/** Token / custom-property name prefix used for hue var naming (`brand-` etc.). */
|
|
1766
|
+
prefix: string;
|
|
1767
|
+
defs: ColorMap;
|
|
1768
|
+
mode: 'theme' | 'standalone';
|
|
1769
|
+
/** Standalone: resolved hue from the primary variant (scheme-independent). */
|
|
1770
|
+
resolvedHue?: number;
|
|
1771
|
+
/**
|
|
1772
|
+
* When false, hue declarations are not emitted (the pass only references
|
|
1773
|
+
* hue vars already declared by a sibling pass). Used by palette primary
|
|
1774
|
+
* unprefixed aliases so they reference the themed `--{themeName}-*-hue`
|
|
1775
|
+
* vars without re-declaring (and colliding with) other themes' base vars.
|
|
1776
|
+
* Defaults to true.
|
|
1777
|
+
*/
|
|
1778
|
+
emitDeclarations?: boolean;
|
|
1779
|
+
}
|
|
1780
|
+
//#endregion
|
|
1781
|
+
//#region src/format-guard.d.ts
|
|
1782
|
+
/**
|
|
1783
|
+
* Throw when a non-native Glaze color space is requested for an export that
|
|
1784
|
+
* emits raw CSS or non-Tasty token maps.
|
|
1785
|
+
*/
|
|
1786
|
+
declare function assertNativeFormat(format: GlazeColorFormat | undefined, method: string): void;
|
|
1787
|
+
/**
|
|
1788
|
+
* Throw when `splitHue` is enabled but any exported color is not pastel.
|
|
1789
|
+
* Hue rotation is only clip-free when chroma is bounded by the hue-independent
|
|
1790
|
+
* safe chroma (`computeSafeChromaOKLCH`).
|
|
1791
|
+
*/
|
|
1792
|
+
declare function assertAllPastel(resolved: Map<string, ResolvedColor>, modes: Required<GlazeOutputModes>): void;
|
|
1793
|
+
//#endregion
|
|
1794
|
+
//#region src/roles.d.ts
|
|
1795
|
+
/**
|
|
1796
|
+
* Normalize a `RoleInput` (canonical value or alias) into a canonical `Role`.
|
|
1797
|
+
* Returns `undefined` for unrecognized strings so callers can fall through to
|
|
1798
|
+
* the next step of the resolution chain.
|
|
1799
|
+
*/
|
|
1800
|
+
declare function normalizeRole(input: RoleInput | undefined): Role | undefined;
|
|
1801
|
+
/**
|
|
1802
|
+
* Infer a `Role` from a color name by matching its tokens against the role
|
|
1803
|
+
* keyword sets. When multiple tokens match, the **last** recognized token
|
|
1804
|
+
* wins (so `button-text` → `text`, `input-bg` → `surface`, `card-border` →
|
|
1805
|
+
* `border`). Returns `undefined` when no token matches.
|
|
1806
|
+
*/
|
|
1807
|
+
declare function inferRoleFromName(name: string): Role | undefined;
|
|
1808
|
+
/** APCA argument order: which side the resolved color plays. */
|
|
1809
|
+
type Polarity = 'fg' | 'bg';
|
|
1810
|
+
/**
|
|
1811
|
+
* Map a role to its APCA polarity. `text` and `border` are foreground spots
|
|
1812
|
+
* against their base (the candidate is the text argument); `surface` is the
|
|
1813
|
+
* background (the base is the text argument).
|
|
1814
|
+
*/
|
|
1815
|
+
declare function roleToPolarity(role: Role): Polarity;
|
|
1816
|
+
/**
|
|
1817
|
+
* The opposite role of `role`, used when a color with no explicit role and no
|
|
1818
|
+
* inferable name depends on a base: the dependent color plays the opposite
|
|
1819
|
+
* role of its base. `surface` ↔ `text`; `border` is treated as a foreground
|
|
1820
|
+
* spot, so its opposite is `surface`.
|
|
1821
|
+
*/
|
|
1822
|
+
declare function oppositeRole(role: Role): Role;
|
|
1823
|
+
//#endregion
|
|
937
1824
|
//#region src/okhst.d.ts
|
|
938
1825
|
/**
|
|
939
1826
|
* Reference eps for the OKHST color space. WCAG 2 contrast is
|
|
@@ -976,7 +1863,11 @@ declare function okhslToOkhst(c: {
|
|
|
976
1863
|
};
|
|
977
1864
|
/**
|
|
978
1865
|
* Edge adapter: a resolved variant stores canonical tone `t` (0–1). Convert
|
|
979
|
-
* it to the OKHSL `{ h, s, l }` the formatters and luminance pipeline expect
|
|
1866
|
+
* it to the OKHSL `{ h, s, l }` the formatters and luminance pipeline expect —
|
|
1867
|
+
* `s` and `l` on the same 0–1 factor scale, so `const { h, s, l } =
|
|
1868
|
+
* variantToOkhsl(v)` destructures straight into `formatOkhsl` / `formatRgb` /
|
|
1869
|
+
* `okhslToLinearSrgb` with no rescaling. `alpha` stays on the variant; use
|
|
1870
|
+
* `glaze.format(v, format)` for a string that carries it.
|
|
980
1871
|
*/
|
|
981
1872
|
declare function variantToOkhsl(v: {
|
|
982
1873
|
h: number;
|
|
@@ -994,7 +1885,9 @@ declare function variantToOkhsl(v: {
|
|
|
994
1885
|
*
|
|
995
1886
|
* Provides bidirectional OKHSL ↔ sRGB conversion, luminance computation
|
|
996
1887
|
* for both contrast metrics (WCAG 2 relative luminance and APCA screen
|
|
997
|
-
* luminance `Ys`
|
|
1888
|
+
* luminance `Ys` — both the exact functions the contrast solver uses, and
|
|
1889
|
+
* both public), strict hex parsing (`parseHex` / `parseHexAlpha` check every
|
|
1890
|
+
* digit), and multi-format output (okhsl, rgb, hsl, oklch).
|
|
998
1891
|
*/
|
|
999
1892
|
type Vec3 = [number, number, number];
|
|
1000
1893
|
/**
|
|
@@ -1031,6 +1924,7 @@ declare function relativeLuminanceFromLinearRgb(rgb: [number, number, number]):
|
|
|
1031
1924
|
declare function contrastRatioFromLuminance(yA: number, yB: number): number;
|
|
1032
1925
|
/**
|
|
1033
1926
|
* Convert OKHSL to gamma-encoded sRGB (clamped to 0–1).
|
|
1927
|
+
* h: 0–360, s: 0–1, l: 0–1. Returns [r, g, b] with each channel 0–1.
|
|
1034
1928
|
*/
|
|
1035
1929
|
declare function okhslToSrgb(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
|
|
1036
1930
|
/**
|
|
@@ -1039,6 +1933,22 @@ declare function okhslToSrgb(h: number, s: number, l: number, pastel?: boolean):
|
|
|
1039
1933
|
* This avoids over/under-estimating luminance for out-of-gamut OKHSL colors.
|
|
1040
1934
|
*/
|
|
1041
1935
|
declare function gamutClampedLuminance(linearRgb: [number, number, number]): number;
|
|
1936
|
+
/**
|
|
1937
|
+
* Compute APCA screen luminance (`Ys`) from linear sRGB.
|
|
1938
|
+
*
|
|
1939
|
+
* APCA does not use the WCAG piecewise sRGB EOTF; it defines its own
|
|
1940
|
+
* luminance as `0.2126·R^2.4 + 0.7152·G^2.4 + 0.0722·B^2.4` over the
|
|
1941
|
+
* gamma-encoded (display) channels with a simple 2.4 exponent. The APCA
|
|
1942
|
+
* soft-clamp threshold in `apcaContrast` is calibrated against this basis,
|
|
1943
|
+
* so the solver must feed it `Ys`, not WCAG relative luminance. Channels
|
|
1944
|
+
* are gamut-clamped to [0, 1] first, matching `gamutClampedLuminance`.
|
|
1945
|
+
*
|
|
1946
|
+
* This is exactly the luminance Glaze's contrast solver (and its drift
|
|
1947
|
+
* check) feeds `apcaContrast`, so
|
|
1948
|
+
* `apcaContrast(apcaLuminanceFromLinearRgb(text), apcaLuminanceFromLinearRgb(bg))`
|
|
1949
|
+
* reproduces the solver's Lc for a resolved pair.
|
|
1950
|
+
*/
|
|
1951
|
+
declare function apcaLuminanceFromLinearRgb(linearRgb: [number, number, number]): number;
|
|
1042
1952
|
/**
|
|
1043
1953
|
* Convert OKLab to OKHSL.
|
|
1044
1954
|
* Input: [L, a, b] where L: 0–1, a/b: roughly -0.5 to 0.5.
|
|
@@ -1060,7 +1970,9 @@ declare function srgbToOkhsl(rgb: [number, number, number], pastel?: boolean): [
|
|
|
1060
1970
|
declare function hslToSrgb(h: number, s: number, l: number): [number, number, number];
|
|
1061
1971
|
/**
|
|
1062
1972
|
* Parse a hex color string (#rgb or #rrggbb) to sRGB [r, g, b] in 0–1 range.
|
|
1063
|
-
* Returns null if the string is not a valid hex
|
|
1973
|
+
* The leading `#` is optional. Returns null if the string is not a valid hex
|
|
1974
|
+
* color: a wrong length, any character outside `0-9a-f` (case-insensitive),
|
|
1975
|
+
* or a form with alpha.
|
|
1064
1976
|
*
|
|
1065
1977
|
* For 8-digit hex (`#rrggbbaa`) and 4-digit hex (`#rgba`) with alpha,
|
|
1066
1978
|
* use {@link parseHexAlpha}.
|
|
@@ -1069,7 +1981,12 @@ declare function parseHex(hex: string): [number, number, number] | null;
|
|
|
1069
1981
|
/**
|
|
1070
1982
|
* Parse a hex color string (#rgb, #rrggbb, #rgba, or #rrggbbaa) to
|
|
1071
1983
|
* sRGB [r, g, b] in 0–1 range plus an optional alpha (0–1).
|
|
1072
|
-
* Returns null if the string is not a valid hex
|
|
1984
|
+
* The leading `#` is optional. Returns null if the string is not a valid hex
|
|
1985
|
+
* color: a wrong length or any character outside `0-9a-f`
|
|
1986
|
+
* (case-insensitive).
|
|
1987
|
+
*
|
|
1988
|
+
* Every digit is checked up front: `parseInt` alone stops at the first bad
|
|
1989
|
+
* character, so `'#1z2z3z'` would otherwise read as `#010203`.
|
|
1073
1990
|
*/
|
|
1074
1991
|
declare function parseHexAlpha(hex: string): {
|
|
1075
1992
|
rgb: [number, number, number];
|
|
@@ -1077,25 +1994,45 @@ declare function parseHexAlpha(hex: string): {
|
|
|
1077
1994
|
} | null;
|
|
1078
1995
|
/**
|
|
1079
1996
|
* Format OKHSL values as a CSS `okhsl(H S% L%)` string.
|
|
1080
|
-
* h: 0–360, s: 0–
|
|
1997
|
+
* h: 0–360, s: 0–1, l: 0–1 (factor scale, as returned by every converter).
|
|
1081
1998
|
*/
|
|
1082
1999
|
declare function formatOkhsl(h: number, s: number, l: number, pastel?: boolean): string;
|
|
2000
|
+
/**
|
|
2001
|
+
* Format OKHST values as a CSS `okhst(H S% T%)` string.
|
|
2002
|
+
* h: 0–360, s: 0–1, t: 0–1 (factor scale, matching `ResolvedColorVariant`).
|
|
2003
|
+
*
|
|
2004
|
+
* Pastel recompute matches `formatOkhsl`: convert via OKLab so external
|
|
2005
|
+
* parsers that only understand non-pastel OKHST render identically.
|
|
2006
|
+
*/
|
|
2007
|
+
declare function formatOkhst(h: number, s: number, t: number, pastel?: boolean): string;
|
|
1083
2008
|
/**
|
|
1084
2009
|
* Format OKHSL values as a CSS `rgb(R G B)` string.
|
|
1085
2010
|
* Uses 2 decimal places to avoid 8-bit quantization contrast loss.
|
|
1086
|
-
* h: 0–360, s: 0–
|
|
2011
|
+
* h: 0–360, s: 0–1, l: 0–1 (factor scale, as returned by every converter).
|
|
1087
2012
|
*/
|
|
1088
2013
|
declare function formatRgb(h: number, s: number, l: number, pastel?: boolean): string;
|
|
1089
2014
|
/**
|
|
1090
2015
|
* Format OKHSL values as a CSS `hsl(H S% L%)` string.
|
|
1091
|
-
* h: 0–360, s: 0–
|
|
2016
|
+
* h: 0–360, s: 0–1, l: 0–1 (factor scale, as returned by every converter).
|
|
1092
2017
|
*/
|
|
1093
2018
|
declare function formatHsl(h: number, s: number, l: number, pastel?: boolean): string;
|
|
1094
2019
|
/**
|
|
1095
2020
|
* Format OKHSL values as a CSS `oklch(L C H)` string.
|
|
1096
|
-
* h: 0–360, s: 0–
|
|
2021
|
+
* h: 0–360, s: 0–1, l: 0–1 (factor scale, as returned by every converter).
|
|
1097
2022
|
*/
|
|
1098
2023
|
declare function formatOklch(h: number, s: number, l: number, pastel?: boolean): string;
|
|
2024
|
+
/**
|
|
2025
|
+
* Convert gamma-encoded sRGB channels (0–1) to a 6-digit lowercase hex
|
|
2026
|
+
* string (`#rrggbb`). Channels are clamped to [0,1] and rounded to 8-bit.
|
|
2027
|
+
* Alpha is not encoded here — DTCG carries it as a separate `alpha` field.
|
|
2028
|
+
*/
|
|
2029
|
+
declare function srgbToHex(rgb: [number, number, number]): `#${string}`;
|
|
2030
|
+
/**
|
|
2031
|
+
* Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLCH components `[L, C, H]`.
|
|
2032
|
+
* L: 0–1, C: 0–~0.4 (chroma), H: 0–360 (hue). Shared by `formatOklch` and
|
|
2033
|
+
* the DTCG `oklch` colorSpace exporter so the two never drift apart.
|
|
2034
|
+
*/
|
|
2035
|
+
declare function okhslToOklch(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
|
|
1099
2036
|
//#endregion
|
|
1100
|
-
export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type ContrastSpec, type ExtremeValue, type FindToneForContrastOptions, type FindToneForContrastResult, type FindValueForMixContrastOptions, type FindValueForMixContrastResult, type GlazeColorCssOptions, type GlazeColorFormat, type GlazeColorInput, type GlazeColorInputExport, type GlazeColorOverrides, type GlazeColorOverridesExport, type GlazeColorToken, type GlazeColorTokenExport, type GlazeColorValue, type GlazeConfig, type GlazeConfigOverride, type GlazeConfigResolved, type GlazeCssOptions, type GlazeCssResult, type GlazeExtendOptions, type GlazeFromInput, type GlazeJsonOptions, type GlazeOutputModes, type GlazePalette, type GlazePaletteExportOptions, type GlazePaletteOptions, type GlazeShadowInput, type GlazeTheme, type GlazeThemeExport, type GlazeTokenOptions, type HCPair, type HexColor, type MinContrast, type MixColorDef, type OkhslColor, type OkhstColor, type OklchColor, REF_EPS, type RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type ResolvedContrast, type RgbColor, type ShadowColorDef, type ShadowTuning, type ToneValue, type ToneWindow, apcaContrast, contrastRatioFromLuminance, cuspLightness, findToneForContrast, findValueForMixContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, fromTone, gamutClampedLuminance, glaze, hslToSrgb, okhslToLinearSrgb, okhslToOkhst, okhslToOklab, okhslToSrgb, okhstToOkhsl, oklabToOkhsl, parseHex, parseHexAlpha, relativeLuminanceFromLinearRgb, resolveContrastForMode, resolveMinContrast, srgbToOkhsl, toTone, toneFromY, variantToOkhsl, yFromTone };
|
|
2037
|
+
export { APCA_HC_ENHANCEMENT, APCA_MAX_LC, APCA_PRESETS, type AdaptationMode, type ApcaPreset, type ChannelCtx, type ColorDef, type ColorMap, type ContrastPreset, type ContrastSpec, type DtcgColorSpace, type DtcgColorToken, type DtcgColorValue, type DtcgDocument, type DtcgOklchColorValue, type DtcgResolverModifier, type DtcgResolverRef, type DtcgResolverSet, type DtcgSrgbColorValue, type DtcgTokenTree, type ExtremeValue, type FindToneForContrastOptions, type FindToneForContrastResult, type FindValueForMixContrastOptions, type FindValueForMixContrastResult, GLAZE_EXPORT_VERSION, type GlazeColorCssOptions, type GlazeColorDtcgResolverOptions, type GlazeColorDtcgResult, type GlazeColorFormat, type GlazeColorInput, type GlazeColorInputExport, type GlazeColorOverrides, type GlazeColorOverridesExport, type GlazeColorTailwindOptions, type GlazeColorToken, type GlazeColorTokenExport, type GlazeColorValue, type GlazeConfig, type GlazeConfigOverride, type GlazeConfigResolved, type GlazeCssOptions, type GlazeCssResult, type GlazeDtcgOptions, type GlazeDtcgResolverContextNames, type GlazeDtcgResolverDocument, type GlazeDtcgResolverOptions, type GlazeDtcgResult, type GlazeExportKind, type GlazeExportVersion, type GlazeExtendOptions, type GlazeFromInput, type GlazeGlowInput, type GlazeJsonOptions, type GlazeLightingInput, type GlazeOutputModes, type GlazePalette, type GlazePaletteCssOptions, type GlazePaletteExport, type GlazePaletteExportOptions, type GlazePaletteOptions, type GlazePaletteTastyOptions, type GlazeShadowInput, type GlazeTailwindOptions, type GlazeTastyOptions, type GlazeTheme, type GlazeThemeExport, type GlazeThemeSeed, type GlazeTokenOptions, type GlowColorDef, type GlowTuning, type HCPair, type HexColor, type HueDeclaration, type HuePlan, type LightingTuning, type MinContrast, type MixColorDef, type OkhslColor, type OkhstColor, type OklchColor, type Polarity, REF_EPS, type RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type ResolvedContrast, type RgbColor, type Role, type RoleInput, type ShadowColorDef, type ShadowTuning, type ToneValue, type ToneWindow, apcaContrast, apcaLuminanceFromLinearRgb, assertAllPastel, assertNativeFormat, contrastRatioFromLuminance, cuspLightness, findToneForContrast, findValueForMixContrast, formatHsl, formatOkhsl, formatOkhst, formatOklch, formatRgb, fromTone, gamutClampedLuminance, glaze, hslToSrgb, inferRoleFromName, isColorTokenExport, isPaletteExport, isThemeExport, normalizeRole, okhslToLinearSrgb, okhslToOkhst, okhslToOklab, okhslToOklch, okhslToSrgb, okhstToOkhsl, oklabToOkhsl, oppositeRole, parseHex, parseHexAlpha, relativeLuminanceFromLinearRgb, resolveApcaTarget, resolveContrastForLevel, resolveContrastForMode, resolveMinContrast, roleToPolarity, srgbToHex, srgbToOkhsl, toTone, toneFromY, variantToOkhsl, yFromTone };
|
|
1101
2038
|
//# sourceMappingURL=index.d.cts.map
|