@tenphi/glaze 0.0.0-snapshot.f3bb46b → 0.0.0-snapshot.fe2bc04

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/dist/index.d.mts CHANGED
@@ -1,48 +1,144 @@
1
1
  //#region src/contrast-solver.d.ts
2
- /**
3
- * OKHSL Contrast Solver
4
- *
5
- * Finds the closest OKHSL lightness that satisfies a WCAG 2 contrast target
6
- * against a base color. Used by glaze when resolving dependent colors
7
- * with `contrast`.
8
- */
9
2
  type LinearRgb = [number, number, number];
10
3
  type ContrastPreset = 'AA' | 'AAA' | 'AA-large' | 'AAA-large';
11
4
  type MinContrast$1 = number | ContrastPreset;
12
- interface FindLightnessForContrastOptions {
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;
34
+ /** Metric + numeric target after resolving a `ContrastSpec` for a mode. */
35
+ interface ResolvedContrast {
36
+ metric: 'wcag' | 'apca';
37
+ /** WCAG ratio (>= 1) or APCA Lc magnitude (0–106). */
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';
46
+ }
47
+ declare function resolveMinContrast(value: MinContrast$1): number;
48
+ /**
49
+ * Resolve a `ContrastSpec` (already selected from any outer HC pair) for a
50
+ * given mode into `{ metric, target }`. Handles the inner metric HC pair and
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).
63
+ */
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;
83
+ /**
84
+ * APCA lightness contrast (Lc), signed: positive for dark text on light bg,
85
+ * negative for light text on dark bg. Inputs are screen luminances (0–1).
86
+ */
87
+ declare function apcaContrast(yText: number, yBg: number): number;
88
+ interface FindToneForContrastOptions {
13
89
  /** Hue of the candidate color (0–360). */
14
90
  hue: number;
15
91
  /** Saturation of the candidate color (0–1). */
16
92
  saturation: number;
17
- /** Preferred lightness of the candidate (0–1). */
18
- preferredLightness: number;
19
- /** Base/reference color as linear sRGB (channels may be outside 0–1 before clamp). */
20
- baseLinearRgb: [number, number, number];
21
- /** WCAG contrast ratio target floor. */
22
- contrast: MinContrast$1;
23
- /** Search bounds for lightness. Default: [0, 1]. */
24
- lightnessRange?: [number, number];
93
+ /** Preferred tone of the candidate (0–1). */
94
+ preferredTone: number;
95
+ /** Base/reference color as linear sRGB. */
96
+ baseLinearRgb: LinearRgb;
97
+ /** Resolved contrast floor (metric + target). */
98
+ contrast: ResolvedContrast;
99
+ /** Search bounds for tone. Default: [0, 1]. */
100
+ toneRange?: [number, number];
25
101
  /** Convergence threshold. Default: 1e-4. */
26
102
  epsilon?: number;
27
- /** Maximum binary-search iterations per branch. Default: 14. */
103
+ /** Maximum binary-search iterations per branch. Default: 18. */
28
104
  maxIterations?: number;
105
+ /** Preferred search direction before auto-flip is considered. */
106
+ initialDirection?: 'lighter' | 'darker';
107
+ /** Auto-flip tone direction when contrast can't be met. Default: false. */
108
+ flip?: boolean;
109
+ /**
110
+ * When `flip` is on and *both* directions meet the target, keep
111
+ * `initialDirection` instead of taking whichever result lands nearer the
112
+ * preferred tone. Default: false (nearest wins).
113
+ *
114
+ * The nearest-wins tie-break is unstable along a ramp of targets: which side
115
+ * is nearer shifts as the target grows, so a color can swap sides between two
116
+ * adjacent targets. Set this when a caller needs the side to be a property of
117
+ * the color rather than of the target — the manual contrast level does. The
118
+ * flip itself is unaffected: an initial direction that cannot reach the
119
+ * target still falls back to the opposite side.
120
+ */
121
+ preferInitial?: boolean;
122
+ /** Use the hue-independent "safe" chroma boundary. Default: false. */
123
+ pastel?: boolean;
29
124
  }
30
- interface FindLightnessForContrastResult {
31
- /** Chosen lightness in 0–1. */
32
- lightness: number;
33
- /** Achieved WCAG contrast ratio. */
125
+ interface FindToneForContrastResult {
126
+ /** Chosen tone in 0–1. */
127
+ tone: number;
128
+ /** Achieved score (WCAG ratio or APCA Lc magnitude). */
34
129
  contrast: number;
35
130
  /** Whether the target was reached. */
36
131
  met: boolean;
37
132
  /** Which branch was selected. */
38
133
  branch: 'lighter' | 'darker' | 'preferred';
134
+ /** Whether the result auto-flipped to the opposite direction. */
135
+ flipped?: boolean;
39
136
  }
40
- declare function resolveMinContrast(value: MinContrast$1): number;
41
137
  /**
42
- * Find the OKHSL lightness that satisfies a WCAG 2 contrast target
43
- * against a base color, staying as close to `preferredLightness` as possible.
138
+ * Find the tone that satisfies a contrast floor against a base color,
139
+ * staying as close to `preferredTone` as possible.
44
140
  */
45
- declare function findLightnessForContrast(options: FindLightnessForContrastOptions): FindLightnessForContrastResult;
141
+ declare function findToneForContrast(options: FindToneForContrastOptions): FindToneForContrastResult;
46
142
  interface FindValueForMixContrastOptions {
47
143
  /** Preferred mix parameter (0–1). */
48
144
  preferredValue: number;
@@ -50,42 +146,84 @@ interface FindValueForMixContrastOptions {
50
146
  baseLinearRgb: LinearRgb;
51
147
  /** Target color as linear sRGB. */
52
148
  targetLinearRgb: LinearRgb;
53
- /** WCAG contrast target. */
54
- contrast: MinContrast$1;
55
- /**
56
- * Compute the luminance of the mixed color at parameter t.
57
- * For opaque: luminance of OKHSL-interpolated color.
58
- * For transparent: luminance of alpha-composited color over base.
59
- */
149
+ /** Resolved contrast floor (metric + target). */
150
+ contrast: ResolvedContrast;
151
+ /** Compute the luminance of the mixed color at parameter t. */
60
152
  luminanceAtValue: (t: number) => number;
61
153
  /** Convergence threshold. Default: 1e-4. */
62
154
  epsilon?: number;
63
155
  /** Maximum binary-search iterations per branch. Default: 20. */
64
156
  maxIterations?: number;
157
+ /** Auto-flip mix direction when contrast can't be met. Default: false. */
158
+ flip?: boolean;
65
159
  }
66
160
  interface FindValueForMixContrastResult {
67
- /** Chosen mix parameter (0–1). */
68
161
  value: number;
69
- /** Achieved WCAG contrast ratio. */
70
162
  contrast: number;
71
- /** Whether the target was reached. */
72
163
  met: boolean;
164
+ flipped?: boolean;
73
165
  }
74
166
  /**
75
- * Find the mix parameter (ratio or opacity) that satisfies a WCAG 2 contrast
76
- * target against a base color, staying as close to `preferredValue` as possible.
167
+ * Find the mix parameter (ratio or opacity) that satisfies a contrast floor
168
+ * against a base color, staying as close to `preferredValue` as possible.
77
169
  */
78
170
  declare function findValueForMixContrast(options: FindValueForMixContrastOptions): FindValueForMixContrastResult;
79
171
  //#endregion
80
172
  //#region src/types.d.ts
81
173
  /** A value or [normal, high-contrast] pair. */
82
174
  type HCPair<T> = T | [T, T];
175
+ /** Bare WCAG contrast target: a ratio number or a named preset. */
83
176
  type MinContrast = number | ContrastPreset;
177
+ /**
178
+ * A contrast floor with a pluggable metric.
179
+ *
180
+ * - `number` / `ContrastPreset`: a WCAG ratio (bare form).
181
+ * - `{ wcag }`: WCAG ratio or preset, optionally an HC pair.
182
+ * - `{ apca }`: APCA Lc target (absolute value or preset), optionally an HC pair.
183
+ *
184
+ * The `[normal, highContrast]` pair may live at the outer level
185
+ * (`[4.5, 7]`, `[{ wcag: 4.5 }, { wcag: 7 }]`) or inside the metric
186
+ * (`{ wcag: [4.5, 7] }`, `{ apca: [45, 60] }`, `{ apca: ['content', 'body'] }`).
187
+ */
188
+ type ContrastSpec = number | ContrastPreset | {
189
+ wcag: HCPair<number | ContrastPreset>;
190
+ } | {
191
+ apca: HCPair<number | ApcaPreset>;
192
+ };
193
+ /**
194
+ * The semantic role a color plays against its base, used to fix APCA contrast
195
+ * polarity (which side is the foreground vs the background). WCAG is
196
+ * symmetric, so role never changes WCAG results.
197
+ */
198
+ type Role = 'text' | 'surface' | 'border';
199
+ /**
200
+ * Any string accepted as a `role`. Canonical values plus aliases normalized by
201
+ * `normalizeRole` (see `roles.ts`): `surface` (bg/background/fill/canvas/
202
+ * paper/layer), `text` (fg/foreground/content/ink/label/stroke), `border`
203
+ * (divider/outline/separator/hairline/rule).
204
+ */
205
+ type RoleInput = Role | 'bg' | 'background' | 'fill' | 'canvas' | 'paper' | 'layer' | 'fg' | 'foreground' | 'content' | 'ink' | 'label' | 'stroke' | 'divider' | 'outline' | 'separator' | 'hairline' | 'rule';
84
206
  type AdaptationMode = 'auto' | 'fixed' | 'static';
85
207
  /** A signed relative offset string, e.g. '+20' or '-15.5'. */
86
208
  type RelativeValue = `+${number}` | `-${number}`;
209
+ /**
210
+ * Force a color to a tone extreme:
211
+ * - `'max'`: the highest tone in the active scheme range/window.
212
+ * - `'min'`: the lowest tone.
213
+ *
214
+ * Under `mode: 'auto'` the extreme inverts in the dark scheme (so `'max'`
215
+ * tracks the inversion and becomes the darkest tone). No `base` required.
216
+ */
217
+ type ExtremeValue = 'max' | 'min';
218
+ /**
219
+ * A tone value as authored on a color.
220
+ * - Number: absolute tone (0–100).
221
+ * - `'+N'` / `'-N'`: relative to the base's tone (requires `base`).
222
+ * - `'max'` / `'min'`: forced to the scheme's tone extreme (no base needed).
223
+ */
224
+ type ToneValue = number | RelativeValue | ExtremeValue;
87
225
  /** Color format for output. */
88
- type GlazeColorFormat = 'okhsl' | 'rgb' | 'hsl' | 'oklch';
226
+ type GlazeColorFormat = 'okhsl' | 'okhst' | 'rgb' | 'hsl' | 'oklch';
89
227
  /**
90
228
  * Controls which scheme variants are generated in the export.
91
229
  * Light is always included (it's the default).
@@ -93,7 +231,15 @@ type GlazeColorFormat = 'okhsl' | 'rgb' | 'hsl' | 'oklch';
93
231
  interface GlazeOutputModes {
94
232
  /** Include dark scheme variants. Default: true. */
95
233
  dark?: boolean;
96
- /** Include high-contrast variants (both light-HC and dark-HC). Default: false. */
234
+ /**
235
+ * Include high-contrast variants (both light-HC and dark-HC). Default: false.
236
+ *
237
+ * Independent of `contrastLevel` — the level positions the normal variants
238
+ * while these stay the true high-contrast resolution, so the two compose. The
239
+ * exception is a global level of 100, where the normal variants already *are*
240
+ * the high-contrast ones: the tier would duplicate them and is dropped.
241
+ * @see GlazeConfig.contrastLevel
242
+ */
97
243
  highContrast?: boolean;
98
244
  }
99
245
  /** Hex color string for DX hints. Runtime validation in `parseHex()`. */
@@ -104,14 +250,66 @@ interface OkhslColor {
104
250
  s: number;
105
251
  l: number;
106
252
  }
253
+ /**
254
+ * Direct OKHST color input — OKHSL with the lightness axis replaced by the
255
+ * contrast-uniform tone axis. `h`: 0–360, `s`: 0–1, `t`: 0–1 (tone).
256
+ */
257
+ interface OkhstColor {
258
+ h: number;
259
+ s: number;
260
+ t: number;
261
+ }
262
+ /** sRGB components in 0–255 (value-shorthand object form). */
263
+ interface RgbColor {
264
+ r: number;
265
+ g: number;
266
+ b: number;
267
+ }
268
+ /** OKLCh components matching CSS `oklch(L C H)` (L/C: 0–1, H: degrees). */
269
+ interface OklchColor {
270
+ l: number;
271
+ c: number;
272
+ h: number;
273
+ }
107
274
  interface RegularColorDef {
108
275
  /**
109
- * Lightness value (0–100).
110
- * - Number: absolute lightness.
111
- * - String ('+N' / '-N'): relative to base color's lightness (requires `base`).
276
+ * Seed this color from a literal color instead of from the theme.
277
+ *
278
+ * Accepts the same values as `glaze.color()` — hex, `rgb()`, `hsl()`,
279
+ * `okhsl()`, `okhst()`, `oklch()`, or a value object. It supplies three
280
+ * things at once: `hue`, `tone`, and — unlike every other color in a theme —
281
+ * an **absolute saturation** rather than a factor of the seed. That last
282
+ * part is the point: a color can now be more saturated than its theme, so
283
+ * honoring a brand color no longer means re-seeding the whole theme to reach
284
+ * it.
285
+ *
286
+ * The **light, normal-contrast** variant reproduces the value exactly
287
+ * (a local `lightTone: false`, matching the value-shorthand form of
288
+ * `glaze.color()`). Dark and high-contrast variants adapt as usual — they
289
+ * are where readability outranks fidelity, and a color pinned across every
290
+ * scheme would defeat both. A `contrast` floor still applies everywhere and
291
+ * still only moves the color when the authored value misses it.
292
+ *
293
+ * Sibling fields override what the value supplied, so
294
+ * `{ from: '#2F5BFF', hue: 300 }` keeps its saturation and tone but rotates
295
+ * the hue.
296
+ */
297
+ from?: GlazeColorValue;
298
+ /**
299
+ * Tone value (0–100, contrast-uniform — see `docs/okhst.md`).
300
+ * - Number: absolute tone.
301
+ * - String ('+N' / '-N'): relative to base color's tone (requires `base`).
302
+ * - `'max'` / `'min'`: force to the scheme's tone extreme (no base needed).
303
+ *
304
+ * Defaults to the tone of `from` when that is set.
305
+ */
306
+ tone?: HCPair<ToneValue>;
307
+ /**
308
+ * Saturation factor applied to the seed saturation (0–1, default: 1).
309
+ *
310
+ * With `from`, an explicit value here is still a factor of the seed and
311
+ * overrides the absolute saturation the color carried.
112
312
  */
113
- lightness?: HCPair<number | RelativeValue>;
114
- /** Saturation factor applied to the seed saturation (0–1, default: 1). */
115
313
  saturation?: number;
116
314
  /**
117
315
  * Hue override for this color.
@@ -119,20 +317,78 @@ interface RegularColorDef {
119
317
  * - String ('+N' / '-N'): relative to the theme seed hue.
120
318
  */
121
319
  hue?: number | RelativeValue;
320
+ /**
321
+ * Dark-scheme hue override. Applies to the `dark` and `darkContrast`
322
+ * variants; falls back to `hue` when omitted.
323
+ * - Number: absolute hue (0–360).
324
+ * - String ('+N' / '-N'): relative to the theme's **dark** seed hue
325
+ * (`GlazeTheme.darkHue`, itself defaulting to the light seed hue).
326
+ *
327
+ * Ignored under `mode: 'static'`, which pins one value across all schemes.
328
+ */
329
+ darkHue?: number | RelativeValue;
330
+ /**
331
+ * Dark-scheme saturation factor (0–1) applied to the dark seed
332
+ * saturation. Applies to the `dark` and `darkContrast` variants; falls
333
+ * back to `saturation` when omitted.
334
+ *
335
+ * When set, the global `darkDesaturation` reduction is **not** applied on
336
+ * top — the resulting saturation is taken literally. Ignored under
337
+ * `mode: 'static'`.
338
+ */
339
+ darkSaturation?: number;
122
340
  /** Name of another color in the same theme (dependent color). */
123
341
  base?: string;
124
- /** WCAG contrast ratio floor against the base color. */
125
- contrast?: HCPair<MinContrast>;
342
+ /**
343
+ * Contrast floor against the base color. A bare number/preset is WCAG;
344
+ * use `{ wcag }` / `{ apca }` to pick the metric. Accepts an HC pair.
345
+ */
346
+ contrast?: HCPair<ContrastSpec>;
126
347
  /** Adaptation mode. Default: 'auto'. */
127
348
  mode?: AdaptationMode;
349
+ /**
350
+ * Whether to flip out-of-bounds results to the opposite side instead of
351
+ * clamping to the extreme. Affects both:
352
+ * - relative `tone`: when `base ± delta` exceeds `[0, 100]`, mirror the
353
+ * delta to the other side of the base. If the mirrored target is also
354
+ * out of range, keep the original delta and clamp on the authored side.
355
+ * - `contrast`: when the requested direction can't meet the floor, try the
356
+ * opposite side (same as the global `autoFlip`).
357
+ *
358
+ * Defaults to the global `autoFlip` config (default `true`). Set `false`
359
+ * to clamp instead.
360
+ */
361
+ autoFlip?: boolean;
128
362
  /**
129
363
  * Fixed opacity (0–1).
130
364
  * Output includes alpha in the CSS value.
131
365
  * Does not affect contrast resolution — a semi-transparent color
132
- * has no fixed perceived lightness, so `contrast` and `opacity`
366
+ * has no fixed perceived tone, so `contrast` and `opacity`
133
367
  * should not be combined (a console.warn is emitted).
134
368
  */
135
369
  opacity?: number;
370
+ /**
371
+ * Per-color override for the hue-independent "safe" chroma limit used in
372
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
373
+ * Falls through to the per-theme / per-token `pastel` override when omitted.
374
+ * @see GlazeConfigOverride.pastel
375
+ */
376
+ pastel?: boolean;
377
+ /**
378
+ * Semantic role against `base`: how this color is used. Fixes APCA contrast
379
+ * polarity (the argument order in `apcaContrast`). WCAG is symmetric so it
380
+ * never affects WCAG results.
381
+ *
382
+ * Resolution: explicit `role` wins; else inferred from the color name when
383
+ * `inferRole` is enabled (default); else the opposite of the base's role;
384
+ * else defaults to `'text'` (foreground).
385
+ */
386
+ role?: RoleInput;
387
+ /**
388
+ * Whether this color is inherited by child themes created via `extend()`.
389
+ * Default: true. Set to false to make this color local to the current theme.
390
+ */
391
+ inherit?: boolean;
136
392
  }
137
393
  /** Shadow tuning knobs. All values use the 0–1 scale (OKHSL). */
138
394
  interface ShadowTuning {
@@ -177,6 +433,18 @@ interface ShadowColorDef {
177
433
  intensity: HCPair<number>;
178
434
  /** Override default tuning. Merged field-by-field with global `shadowTuning`. */
179
435
  tuning?: ShadowTuning;
436
+ /**
437
+ * Per-color override for the hue-independent "safe" chroma limit used in
438
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
439
+ * Falls through to the per-theme / per-token `pastel` override when omitted.
440
+ * @see GlazeConfigOverride.pastel
441
+ */
442
+ pastel?: boolean;
443
+ /**
444
+ * Whether this color is inherited by child themes created via `extend()`.
445
+ * Default: true. Set to false to make this color local to the current theme.
446
+ */
447
+ inherit?: boolean;
180
448
  }
181
449
  interface MixColorDef {
182
450
  type: 'mix';
@@ -199,31 +467,65 @@ interface MixColorDef {
199
467
  /**
200
468
  * Interpolation color space for opaque blending. Default: 'okhsl'.
201
469
  * - 'okhsl': perceptually uniform, consistent with Glaze's internal model.
202
- * - 'srgb': linear sRGB interpolation, matches browser compositing.
470
+ * - 'srgb': linear-light sRGB interpolation (like CSS
471
+ * `color-mix(in srgb-linear, …)`).
203
472
  *
204
- * Ignored for 'transparent' blend (always composites in linear sRGB).
473
+ * Ignored for 'transparent' blend: the browser composites that one, and
474
+ * its contrast solve models the browser (`source-over` on gamma-encoded
475
+ * sRGB).
205
476
  */
206
477
  space?: 'okhsl' | 'srgb';
207
478
  /**
208
- * Minimum WCAG contrast between the base and the resulting color.
479
+ * Minimum contrast between the base and the resulting color.
209
480
  * In 'opaque' mode, adjusts the mix ratio to meet contrast.
210
481
  * In 'transparent' mode, adjusts opacity to meet contrast against the composite.
211
- * Supports [normal, highContrast] pair.
482
+ * A bare number/preset is WCAG; use `{ wcag }` / `{ apca }` to pick the
483
+ * metric. Supports [normal, highContrast] pair.
484
+ */
485
+ contrast?: HCPair<ContrastSpec>;
486
+ /**
487
+ * Per-color override for the hue-independent "safe" chroma limit used in
488
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
489
+ * Falls through to the per-theme / per-token `pastel` override when omitted.
490
+ * @see GlazeConfigOverride.pastel
212
491
  */
213
- contrast?: HCPair<MinContrast>;
492
+ pastel?: boolean;
493
+ /**
494
+ * Semantic role of the mixed result against `base`. Same semantics as
495
+ * `RegularColorDef.role` (fixes APCA polarity). Resolution and defaults
496
+ * are identical.
497
+ */
498
+ role?: RoleInput;
499
+ /**
500
+ * Whether this color is inherited by child themes created via `extend()`.
501
+ * Default: true. Set to false to make this color local to the current theme.
502
+ */
503
+ inherit?: boolean;
214
504
  }
215
505
  type ColorDef = RegularColorDef | ShadowColorDef | MixColorDef;
216
506
  type ColorMap = Record<string, ColorDef>;
217
- /** Resolved color for a single scheme variant. */
507
+ /**
508
+ * Resolved color for a single scheme variant.
509
+ *
510
+ * Stored in OKHST: `h` / `s` are OKHSL hue/saturation, `t` is the canonical
511
+ * contrast-uniform tone (0–1, reference eps). Convert to OKHSL lightness via
512
+ * `variantToOkhsl` at the rendering / luminance edges.
513
+ */
218
514
  interface ResolvedColorVariant {
219
515
  /** OKHSL hue (0–360). */
220
516
  h: number;
221
517
  /** OKHSL saturation (0–1). */
222
518
  s: number;
223
- /** OKHSL lightness (0–1). */
224
- l: number;
519
+ /** Canonical tone (0–1, reference eps). */
520
+ t: number;
225
521
  /** Opacity (0–1). Default: 1. */
226
522
  alpha: number;
523
+ /**
524
+ * Effective `pastel` flag used while resolving this variant (author def or
525
+ * config fallback). Carried on the variant so output formatting matches the
526
+ * gamut mapping applied during resolution.
527
+ */
528
+ pastel?: boolean;
227
529
  }
228
530
  /** Fully resolved color across all scheme variants. */
229
531
  interface ResolvedColor {
@@ -235,65 +537,430 @@ interface ResolvedColor {
235
537
  /** Adaptation mode. Present only for regular colors, omitted for shadows. */
236
538
  mode?: AdaptationMode;
237
539
  }
540
+ /**
541
+ * A scheme tone window.
542
+ * - `[lo, hi]`: OKHSL-lightness endpoints (0–100) the authored tone is
543
+ * remapped into, using the reference eps `0.05`. The common form.
544
+ * - `{ lo, hi, eps }`: same, with an explicit render curvature `eps`
545
+ * (advanced — most palettes never need this).
546
+ * - `false`: disable clamping (full range `[0, 100]` at the reference eps).
547
+ * This removes the *boundaries*, not the tone curve.
548
+ */
549
+ type ToneWindow = false | [number, number] | {
550
+ lo: number;
551
+ hi: number;
552
+ eps: number;
553
+ };
238
554
  interface GlazeConfig {
239
- /** Light scheme lightness window [lo, hi]. Default: [10, 100]. */
240
- lightLightness?: [number, number];
241
- /** Dark scheme lightness window [lo, hi]. Default: [15, 95]. */
242
- darkLightness?: [number, number];
555
+ /** Light scheme tone window — `[lo, hi]` (default `[10, 100]`), `{ lo, hi, eps }` for advanced eps tuning, or `false` to disable clamping. */
556
+ lightTone?: ToneWindow;
557
+ /** Dark scheme tone window — `[lo, hi]` (default `[15, 95]`), `{ lo, hi, eps }`, or `false` to disable clamping. */
558
+ darkTone?: ToneWindow;
243
559
  /** Saturation reduction factor for dark scheme (0–1). Default: 0.1. */
244
560
  darkDesaturation?: number;
245
561
  /**
246
- * Möbius beta for dark auto-inversion (0–1).
247
- * Lower values expand subtle near-white distinctions in dark mode.
248
- * Set to 1 for linear (legacy) behavior. Default: 0.5.
249
- * Accepts [normal, highContrast] pair for separate HC tuning.
562
+ * State alias names for Tasty token export. Default to media-query states
563
+ * (`'@media(prefers-color-scheme: dark)'` / `'@media(prefers-contrast: more)'`)
564
+ * so tokens react to the OS preference without registering custom states.
250
565
  */
251
- darkCurve?: HCPair<number>;
252
- /** State alias names for token export. */
253
566
  states?: {
254
567
  dark?: string;
255
568
  highContrast?: string;
256
569
  };
257
- /** Which scheme variants to include in exports. Default: both true. */
570
+ /**
571
+ * Which scheme variants to include in exports. Defaults: `dark: true`,
572
+ * `highContrast: false`.
573
+ */
258
574
  modes?: GlazeOutputModes;
259
575
  /** Default tuning for all shadow colors. Per-color tuning merges field-by-field. */
260
576
  shadowTuning?: ShadowTuning;
577
+ /**
578
+ * Manual contrast level — a 0–100 slider from normal contrast (`0`) to high
579
+ * contrast (`100`), or `'auto'` (the default) to take the authored normal
580
+ * entries as-is.
581
+ *
582
+ * With a number, Glaze resolves the `light` / `dark` variants *at* that level.
583
+ * That is all it does: `lightContrast` / `darkContrast` stay the true
584
+ * high-contrast resolution at every level, and `modes.highContrast` alone
585
+ * decides whether they are emitted. Level `0` therefore reproduces `'auto'`
586
+ * bit for bit. At `100` the normal variants *are* the high-contrast ones, so a
587
+ * separate tier would duplicate them and a global level of 100 drops it.
588
+ *
589
+ * The level interpolates all three things that make high contrast differ:
590
+ * authored `[normal, highContrast]` pairs, the tone-window widening, and
591
+ * the `AA → AAA` / APCA `+15 Lc` escalation. Contrast floors are re-solved
592
+ * at the interpolated target, so every level is a solution rather than an
593
+ * approximation, and a color keeps to one side of its base as the level moves.
594
+ *
595
+ * Pass `'auto'` to leave manual mode; `configure()` never clears a field by
596
+ * omission. See `docs/api.md` for the ramp's edge cases (un-interpolable
597
+ * pairs, side changes) and the export-freeze rule.
598
+ *
599
+ * @default 'auto'
600
+ */
601
+ contrastLevel?: number | 'auto';
602
+ /**
603
+ * Automatically flip tone direction when contrast can't be met.
604
+ *
605
+ * When enabled (default `true`), the solver searches the requested
606
+ * tone direction first. If that direction can't reach the target,
607
+ * it tries the opposite direction and uses it when it passes. If neither
608
+ * side passes, the tone is pinned to the requested-direction
609
+ * extreme and a warning is emitted.
610
+ *
611
+ * Set to `false` for strict "no flip" behavior. The opposite
612
+ * direction is never considered: if the requested direction can't
613
+ * meet the target, the tone is pinned to its extreme (never
614
+ * falls back to the originally requested tone).
615
+ */
616
+ autoFlip?: boolean;
617
+ /**
618
+ * If true (default), infer a color's `role` from its name when no explicit
619
+ * `role` is set. Set to `false` to opt out of name-based inference (the
620
+ * base-opposite and default-foreground fallbacks still apply).
621
+ * @default true
622
+ */
623
+ inferRole?: boolean;
261
624
  }
262
625
  interface GlazeConfigResolved {
263
- lightLightness: [number, number];
264
- darkLightness: [number, number];
626
+ lightTone: ToneWindow;
627
+ darkTone: ToneWindow;
265
628
  darkDesaturation: number;
266
- darkCurve: HCPair<number>;
267
629
  states: {
268
630
  dark: string;
269
631
  highContrast: string;
270
632
  };
271
633
  modes: Required<GlazeOutputModes>;
272
634
  shadowTuning?: ShadowTuning;
635
+ autoFlip: boolean;
636
+ /**
637
+ * Manual contrast level (0–100) for the normal variants, or `'auto'` to take
638
+ * the authored normal entries as-is.
639
+ * @see GlazeConfig.contrastLevel
640
+ */
641
+ contrastLevel: number | 'auto';
642
+ /**
643
+ * Instance-level pastel default (`def.pastel ?? config.pastel`).
644
+ * Not set via `glaze.configure()` — only via per-theme / per-token
645
+ * `GlazeConfigOverride` (default `false`).
646
+ */
647
+ pastel: boolean;
648
+ inferRole: boolean;
649
+ }
650
+ /**
651
+ * Per-instance config override for `glaze.color()` and `glaze()` themes.
652
+ * Fields that are set take priority over the live global config. Fields
653
+ * that are omitted fall through to the live global at resolve time
654
+ * (`pastel` is instance-only and defaults to `false` when omitted).
655
+ *
656
+ * `false` for a tone window disables clamping (full range at reference eps).
657
+ */
658
+ interface GlazeConfigOverride {
659
+ /** Light scheme tone window, or `false` to disable clamping. */
660
+ lightTone?: ToneWindow;
661
+ /** Dark scheme tone window, or `false` to disable clamping. */
662
+ darkTone?: ToneWindow;
663
+ /** Saturation reduction factor for dark scheme (0–1). */
664
+ darkDesaturation?: number;
665
+ /** Whether to auto-flip tone when contrast can't be met. */
666
+ autoFlip?: boolean;
667
+ /**
668
+ * Manual contrast level (0–100) for this instance, or `'auto'` to opt out of a
669
+ * global level and take the authored normal entries as-is. Either way the
670
+ * instance keeps its high-contrast tier; a per-instance level never changes
671
+ * which modes are emitted.
672
+ *
673
+ * Only an instance-authored level is frozen into `.export()` snapshots — a
674
+ * level inherited from the global config is treated as a live preference and
675
+ * re-read at restore time.
676
+ *
677
+ * @see GlazeConfig.contrastLevel
678
+ */
679
+ contrastLevel?: number | 'auto';
680
+ /**
681
+ * Instance-level pastel default for colors that omit per-color `pastel`.
682
+ * Not available on `glaze.configure()` — set here or per-color.
683
+ * @default false
684
+ */
685
+ pastel?: boolean;
686
+ /**
687
+ * If true, infer a color's `role` from its name when no explicit `role` is
688
+ * set. Falls through to the live global at resolve time when omitted.
689
+ */
690
+ inferRole?: boolean;
691
+ /**
692
+ * Shadow tuning defaults. Only meaningful for themes; harmless on
693
+ * standalone color tokens.
694
+ */
695
+ shadowTuning?: ShadowTuning;
273
696
  }
697
+ /**
698
+ * Current authoring-export schema version. Bump when the export shape
699
+ * changes in a non-compatible way. Written on every `.export()` snapshot.
700
+ */
701
+ declare const GLAZE_EXPORT_VERSION: 1;
702
+ /** Literal type of {@link GLAZE_EXPORT_VERSION}. */
703
+ type GlazeExportVersion = typeof GLAZE_EXPORT_VERSION;
704
+ /** Discriminator for authoring export snapshots. */
705
+ type GlazeExportKind = 'theme' | 'color' | 'palette';
274
706
  /** Serialized theme configuration (no resolved values). */
275
707
  interface GlazeThemeExport {
708
+ /** Snapshot kind. Always written by `theme.export()`; optional on legacy hand-written configs. */
709
+ kind?: 'theme';
710
+ /** Schema version. Always written by `theme.export()`; optional on legacy configs. */
711
+ version?: number;
276
712
  hue: number;
277
713
  saturation: number;
714
+ /** Dark-scheme seed hue (0–360). Omitted when the theme reuses `hue`. */
715
+ darkHue?: number;
716
+ /** Dark-scheme seed saturation (0–100). Omitted when the theme reuses `saturation`. */
717
+ darkSaturation?: number;
278
718
  colors: ColorMap;
719
+ /**
720
+ * Effective config freeze from `.export()` —
721
+ * `getConfig() ∪ instance local ∪ exportArg`. May be sparse on legacy
722
+ * snapshots (omitted fields fall through to the live global at restore).
723
+ */
724
+ config?: GlazeConfigOverride;
279
725
  }
280
726
  /** Input for `glaze.shadow()` standalone factory. */
281
727
  interface GlazeShadowInput {
282
- /** Background color — hex string or OKHSL { h, s (0-1), l (0-1) }. */
283
- bg: HexColor | OkhslColor;
284
- /** Foreground color for tinting + intensity modulation. */
285
- fg?: HexColor | OkhslColor;
728
+ /**
729
+ * Background color — accepts any `GlazeColorValue` form: hex
730
+ * (`#rgb` / `#rrggbb` / `#rrggbbaa`), `rgb()` / `hsl()` / `okhsl()`
731
+ * / `oklch()` strings, or literal objects (`{ r, g, b }`, `{ h, s, l }`,
732
+ * `{ l, c, h }`). Alpha components are dropped with a warning.
733
+ */
734
+ bg: GlazeColorValue;
735
+ /**
736
+ * Foreground color for tinting + intensity modulation. Accepts the
737
+ * same forms as `bg`.
738
+ */
739
+ fg?: GlazeColorValue;
286
740
  /** Intensity 0-100. */
287
741
  intensity: number;
288
742
  tuning?: ShadowTuning;
289
743
  }
290
- /** Input for `glaze.color()` standalone factory. */
744
+ /** Input for the structured `glaze.color()` overload. */
291
745
  interface GlazeColorInput {
292
746
  hue: number;
293
747
  saturation: number;
294
- lightness: HCPair<number>;
748
+ tone: HCPair<number | ExtremeValue>;
749
+ saturationFactor?: number;
750
+ /**
751
+ * Dark-scheme hue. Number is absolute (0–360); `'+N'`/`'-N'` is relative
752
+ * to the dark seed hue, which defaults to `hue`. Falls back to `hue`.
753
+ */
754
+ darkHue?: number | RelativeValue;
755
+ /** Dark-scheme seed saturation (0–100). Defaults to `saturation`. */
756
+ darkSaturation?: number;
757
+ /** Dark-scheme multiplier on the dark seed (0–1). Defaults to `saturationFactor`. */
758
+ darkSaturationFactor?: number;
759
+ mode?: AdaptationMode;
760
+ /** Flip out-of-bounds results instead of clamping. Default: global `autoFlip`. */
761
+ autoFlip?: boolean;
762
+ /**
763
+ * Fixed opacity (0–1). Output includes alpha in the CSS value.
764
+ * Combining with `contrast` is not recommended (perceived tone
765
+ * becomes unpredictable) — a `console.warn` is emitted in that case.
766
+ */
767
+ opacity?: number;
768
+ /**
769
+ * Optional dependency on another color. Same semantics as
770
+ * `GlazeColorOverrides.base` — `contrast` and relative `tone`
771
+ * anchor to the base per scheme.
772
+ */
773
+ base?: GlazeColorToken | GlazeColorValue;
774
+ /**
775
+ * Contrast floor against `base`. Requires `base` to be set. A bare
776
+ * number/preset is WCAG; use `{ wcag }` / `{ apca }` to pick the metric.
777
+ */
778
+ contrast?: HCPair<ContrastSpec>;
779
+ /**
780
+ * Optional human-readable name for the token. Used in error and
781
+ * warning messages (otherwise an internal name like `"value"` is
782
+ * used). Does not affect output keys.
783
+ */
784
+ name?: string;
785
+ /**
786
+ * Per-color override for the hue-independent "safe" chroma limit used in
787
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
788
+ * Falls through to the per-theme / per-token `pastel` override when omitted.
789
+ * @see GlazeConfigOverride.pastel
790
+ */
791
+ pastel?: boolean;
792
+ /**
793
+ * Semantic role against `base` / the literal seed: how this token is used.
794
+ * Fixes APCA contrast polarity. Same resolution chain as
795
+ * `RegularColorDef.role` (explicit → name inference → opposite of base →
796
+ * `'text'`). For standalone tokens the name is internal, so set `role`
797
+ * explicitly or rely on the base-opposite / foreground default.
798
+ */
799
+ role?: RoleInput;
800
+ }
801
+ /**
802
+ * Any single-color input form accepted by the value-shorthand
803
+ * overload of `glaze.color()`.
804
+ *
805
+ * Strings cover hex (`#rgb` / `#rrggbb` / `#rrggbbaa`, alpha dropped
806
+ * with a warning) and the four CSS color functions Glaze itself emits:
807
+ * `rgb()`, `hsl()`, `okhsl()`, `oklch()` (alpha components also dropped
808
+ * with a warning).
809
+ *
810
+ * Literal object forms:
811
+ * - `{ h, s, l }` — OKHSL (h: 0–360, s/l: 0–1). Passing 0–100 for `s`/`l`
812
+ * throws with a hint to use the structured form.
813
+ * - `{ h, s, t }` — OKHST (h: 0–360, s/t: 0–1). Tone in 0–1.
814
+ * - `{ r, g, b }` — sRGB 0–255.
815
+ * - `{ l, c, h }` — OKLCh (L/C: 0–1, H: degrees), same as `oklch()` strings.
816
+ */
817
+ type GlazeColorValue = string | OkhslColor | OkhstColor | RgbColor | OklchColor;
818
+ /** Color overrides for the `from` and value-shorthand inputs. */
819
+ interface GlazeColorOverrides {
820
+ /**
821
+ * Override hue. Number is absolute (0–360); `'+N'`/`'-N'` is relative
822
+ * to the extracted (or overridden) seed hue — same semantics as
823
+ * `RegularColorDef.hue`.
824
+ */
825
+ hue?: number | RelativeValue;
826
+ /** Override seed saturation (0–100). Default: extracted from value. */
827
+ saturation?: number;
828
+ /**
829
+ * Dark-scheme hue. Number is absolute (0–360); `'+N'`/`'-N'` is relative
830
+ * to the dark seed hue, which defaults to the (possibly overridden) seed
831
+ * hue. Falls back to `hue` when omitted.
832
+ */
833
+ darkHue?: number | RelativeValue;
834
+ /**
835
+ * Dark-scheme seed saturation (0–100). Defaults to `saturation`. When set,
836
+ * the global `darkDesaturation` reduction is not applied on top.
837
+ */
838
+ darkSaturation?: number;
839
+ /**
840
+ * Dark-scheme multiplier on the dark seed (0–1). Defaults to
841
+ * `saturationFactor`. When set, the global `darkDesaturation` reduction is
842
+ * not applied on top.
843
+ */
844
+ darkSaturationFactor?: number;
845
+ /**
846
+ * Override tone. Number is absolute (0–100, contrast-uniform); `'+N'`/`'-N'`
847
+ * is relative to the literal seed (the value passed to `glaze.color()`);
848
+ * `'max'` / `'min'` force to the scheme's tone extreme.
849
+ * Supports HCPair for high-contrast.
850
+ */
851
+ tone?: HCPair<ToneValue>;
852
+ /** Saturation multiplier on the seed (0–1). Default: 1. */
295
853
  saturationFactor?: number;
854
+ /**
855
+ * Adaptation mode. Defaults to `'auto'` for every input form, so
856
+ * colors automatically adapt between light and dark like an ordinary
857
+ * theme color. Value-shorthand inputs (strings and literal objects)
858
+ * preserve light tone via a local `lightTone: false` default; other
859
+ * omitted config fields fall through to the live global at resolve
860
+ * time. Structured `{ hue, saturation, tone }` form also falls
861
+ * through for both tone windows unless overridden.
862
+ *
863
+ * Pass `'fixed'` explicitly to opt back into the linear, non-
864
+ * inverting mapping; pass `'static'` to pin the same tone
865
+ * across every variant.
866
+ */
296
867
  mode?: AdaptationMode;
868
+ /**
869
+ * Flip out-of-bounds results (relative `tone` overshoot / unmet
870
+ * `contrast`) to the opposite side instead of clamping. Defaults to
871
+ * the global `autoFlip`.
872
+ */
873
+ autoFlip?: boolean;
874
+ /**
875
+ * Contrast floor. By default solved against the literal seed
876
+ * (the value itself); when `base` is set, solved against the base's
877
+ * resolved variant per scheme. Same shape as `RegularColorDef.contrast`
878
+ * (bare number/preset = WCAG; `{ wcag }` / `{ apca }` to pick the metric).
879
+ */
880
+ contrast?: HCPair<ContrastSpec>;
881
+ /**
882
+ * Optional dependency on another color. Accepts either a
883
+ * `GlazeColorToken` (returned by another `glaze.color()`) or a raw
884
+ * `GlazeColorValue` (hex / CSS strings / `{ r, g, b }` / `{ h, s, l }` / …),
885
+ * which is automatically wrapped in `glaze.color(value)`.
886
+ *
887
+ * When set:
888
+ * - `contrast` is solved against the base's resolved variant
889
+ * per-scheme (light / dark / lightContrast / darkContrast).
890
+ * - Relative `tone: '+N'` / `'-N'` is anchored to the base's
891
+ * tone per-scheme (matches theme behavior for dependent colors).
892
+ * - Relative `hue: '+N'` / `'-N'` still anchors to the seed (the
893
+ * value passed to `glaze.color()`), not the base.
894
+ * - When the base was created via the structured form (with explicit
895
+ * `hue`/`saturation`/`tone`), it is resolved at full range
896
+ * (`lightTone: false`) for the linking math — ensuring the
897
+ * contrast/tone anchor matches the input tone, not the
898
+ * windowed output. The base's own `.resolve()` output is unaffected.
899
+ *
900
+ * The base token's `.resolve()` is called lazily on first resolve and
901
+ * its result is captured by reference; later mutations to the base's
902
+ * defining call don't apply (matches existing token snapshot semantics).
903
+ */
904
+ base?: GlazeColorToken | GlazeColorValue;
905
+ /**
906
+ * Fixed opacity (0–1). Output includes alpha in the CSS value.
907
+ * Combining with `contrast` is not recommended (perceived tone
908
+ * becomes unpredictable) — a `console.warn` is emitted in that case.
909
+ */
910
+ opacity?: number;
911
+ /**
912
+ * Optional human-readable name for the token. Used in error and
913
+ * warning messages (otherwise an internal name like `"value"` is
914
+ * used). Does not affect output keys.
915
+ */
916
+ name?: string;
917
+ /**
918
+ * Per-color override for the hue-independent "safe" chroma limit used in
919
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
920
+ * Falls through to the per-theme / per-token `pastel` override when omitted.
921
+ * @see GlazeConfigOverride.pastel
922
+ */
923
+ pastel?: boolean;
924
+ /**
925
+ * Semantic role against `base` / the literal seed: how this token is used.
926
+ * Fixes APCA contrast polarity. Same resolution chain as
927
+ * `RegularColorDef.role`.
928
+ */
929
+ role?: RoleInput;
930
+ }
931
+ /**
932
+ * Object input for `glaze.color()` that carries a raw color value plus
933
+ * optional color overrides in the same object.
934
+ *
935
+ * ```ts
936
+ * glaze.color({ from: '#1a1a2e', base: bg, contrast: 'AA' })
937
+ * glaze.color({ from: { r: 38, g: 252, b: 178 }, tone: '+10' })
938
+ * ```
939
+ */
940
+ interface GlazeFromInput extends GlazeColorOverrides {
941
+ /** The source color value. Accepts the same forms as a bare `GlazeColorValue`. */
942
+ from: GlazeColorValue;
943
+ }
944
+ /** Options for `GlazeColorToken.css()`. */
945
+ interface GlazeColorCssOptions {
946
+ /**
947
+ * Custom property base name (without leading `--`). Required.
948
+ * Becomes the variable identifier in the output, e.g.
949
+ * `name: 'brand'` → `--brand-color: …`.
950
+ */
951
+ name: string;
952
+ /** Output color format. Default: 'oklch'. */
953
+ format?: GlazeColorFormat;
954
+ /**
955
+ * Suffix appended to the name. Default: '-color' (matches
956
+ * `theme.css` default).
957
+ */
958
+ suffix?: string;
959
+ /**
960
+ * Emit hue as a separate custom property, referenced via `var()`.
961
+ * Requires `format: 'oklch'` and a pastel token. oklch + all-pastel only.
962
+ */
963
+ splitHue?: boolean;
297
964
  }
298
965
  /** Return type for `glaze.color()`. */
299
966
  interface GlazeColorToken {
@@ -303,18 +970,156 @@ interface GlazeColorToken {
303
970
  token(options?: GlazeTokenOptions): Record<string, string>;
304
971
  /**
305
972
  * Export as a tasty style-to-state binding (no color name key).
306
- * Uses `#name` keys and state aliases (`''`, `@dark`, etc.).
307
- * @see https://cube-ui-kit.vercel.app/?path=/docs/tasty-documentation--docs
973
+ * Uses `#name` keys and state aliases (`''`, `'@media(prefers-color-scheme: dark)'`, etc.).
974
+ * @see https://tasty.style/docs
308
975
  */
309
976
  tasty(options?: GlazeTokenOptions): Record<string, string>;
310
977
  /** Export as a flat JSON map (no color name key). */
311
978
  json(options?: GlazeJsonOptions): Record<string, string>;
979
+ /** Export as CSS custom property declarations grouped by scheme variant. */
980
+ css(options: GlazeColorCssOptions): GlazeCssResult;
981
+ /**
982
+ * Export as W3C DTCG color tokens (one per scheme variant, no color name
983
+ * key). Each entry is a full `{ $type: 'color', $value }` token.
984
+ * @see https://www.designtokens.org/
985
+ */
986
+ dtcg(options?: GlazeDtcgOptions): GlazeColorDtcgResult;
987
+ /**
988
+ * Export as a single W3C DTCG Resolver-Module document for this color,
989
+ * keyed by `name` across all scheme variants. `name` is required.
990
+ * @see https://www.designtokens.org/
991
+ */
992
+ dtcgResolver(options: GlazeColorDtcgResolverOptions): GlazeDtcgResolverDocument;
993
+ /**
994
+ * Export as a Tailwind CSS v4 `@theme` block (light baseline) plus dark /
995
+ * high-contrast overrides. Returns a single ready-to-paste CSS string.
996
+ * `name` is required (forms `--color-<name>`).
997
+ * @see https://tailwindcss.com/docs/theme
998
+ */
999
+ tailwind(options: GlazeColorTailwindOptions): string;
1000
+ /**
1001
+ * Serialize the token as a JSON-safe object. Captures the original
1002
+ * input value, overrides, and config so it can be rehydrated via
1003
+ * `glaze.colorFrom(...)`. `base` is recursively serialized.
1004
+ * Optional `override` is merged over the instance local at export time.
1005
+ */
1006
+ export(override?: GlazeConfigOverride): GlazeColorTokenExport;
1007
+ }
1008
+ /**
1009
+ * JSON-safe serialization of a `glaze.color()` token. Pass to
1010
+ * `glaze.colorFrom(...)` to rehydrate.
1011
+ */
1012
+ interface GlazeColorTokenExport {
1013
+ /** Snapshot kind. Always written by `token.export()`; optional on legacy snapshots. */
1014
+ kind?: 'color';
1015
+ /** Schema version. Always written by `token.export()`; optional on legacy snapshots. */
1016
+ version?: number;
1017
+ /**
1018
+ * Discriminator for the source overload that created the token.
1019
+ * - `'value'`: created via `glaze.color(value)` or `glaze.color({ from, ...overrides })`.
1020
+ * - `'structured'`: created via `glaze.color({ hue, saturation, ... })`.
1021
+ */
1022
+ form: 'value' | 'structured';
1023
+ /** Original input. For `form: 'value'` this is the raw `GlazeColorValue`; for `form: 'structured'` this is the structured input. */
1024
+ input: GlazeColorValue | GlazeColorInputExport;
1025
+ /**
1026
+ * Overrides recorded at creation time. `base` is recursively
1027
+ * serialized. Only present for `form: 'value'`.
1028
+ */
1029
+ overrides?: GlazeColorOverridesExport;
1030
+ /**
1031
+ * Effective config freeze from `.export()` — `getConfig() ∪ local ∪
1032
+ * exportArg` at call time. Used by `glaze.colorFrom()` to pin
1033
+ * deterministic behavior across later `configure()` calls.
1034
+ */
1035
+ config?: GlazeConfigOverride;
1036
+ }
1037
+ /**
1038
+ * JSON-safe serialization of a `glaze.palette()` composition.
1039
+ * Pass to `glaze.paletteFrom(...)` to rehydrate.
1040
+ */
1041
+ interface GlazePaletteExport {
1042
+ /** Snapshot kind. Always written by `palette.export()`. */
1043
+ kind?: 'palette';
1044
+ /** Schema version. Always written by `palette.export()`. */
1045
+ version?: number;
1046
+ /** Per-theme authoring snapshots keyed by theme name. */
1047
+ themes: Record<string, GlazeThemeExport>;
1048
+ /** Primary theme name, if set on the palette. */
1049
+ primary?: string;
1050
+ }
1051
+ /**
1052
+ * Serializable shape of a structured `glaze.color({...})` input.
1053
+ * Differs from `GlazeColorInput` only in that `base` is replaced by an
1054
+ * `export` instead of a token reference.
1055
+ */
1056
+ interface GlazeColorInputExport {
1057
+ hue: number;
1058
+ saturation: number;
1059
+ tone: HCPair<number | ExtremeValue>;
1060
+ saturationFactor?: number;
1061
+ darkHue?: number | RelativeValue;
1062
+ darkSaturation?: number;
1063
+ darkSaturationFactor?: number;
1064
+ mode?: AdaptationMode;
1065
+ autoFlip?: boolean;
1066
+ opacity?: number;
1067
+ base?: GlazeColorTokenExport | GlazeColorValue;
1068
+ contrast?: HCPair<ContrastSpec>;
1069
+ name?: string;
1070
+ pastel?: boolean;
1071
+ role?: RoleInput;
1072
+ }
1073
+ /**
1074
+ * Serializable shape of `GlazeColorOverrides`. `base` is replaced by
1075
+ * its export (or left as a `GlazeColorValue` if it was originally a value).
1076
+ */
1077
+ interface GlazeColorOverridesExport {
1078
+ hue?: number | RelativeValue;
1079
+ saturation?: number;
1080
+ darkHue?: number | RelativeValue;
1081
+ darkSaturation?: number;
1082
+ darkSaturationFactor?: number;
1083
+ tone?: HCPair<ToneValue>;
1084
+ saturationFactor?: number;
1085
+ mode?: AdaptationMode;
1086
+ autoFlip?: boolean;
1087
+ contrast?: HCPair<ContrastSpec>;
1088
+ base?: GlazeColorTokenExport | GlazeColorValue;
1089
+ opacity?: number;
1090
+ name?: string;
1091
+ pastel?: boolean;
1092
+ role?: RoleInput;
1093
+ }
1094
+ /**
1095
+ * The hue/saturation seed pair a theme resolves against.
1096
+ *
1097
+ * `darkHue` / `darkSaturation` are a separate seed for the `dark` and
1098
+ * `darkContrast` variants; each falls back to its light counterpart. Setting
1099
+ * `darkSaturation` opts the theme out of the global `darkDesaturation`
1100
+ * reduction — the authored value is used literally.
1101
+ */
1102
+ interface GlazeThemeSeed {
1103
+ /** Light-scheme hue seed (0–360). */
1104
+ hue: number;
1105
+ /** Light-scheme saturation seed (0–100). */
1106
+ saturation: number;
1107
+ /** Dark-scheme hue seed (0–360). Defaults to `hue`. */
1108
+ darkHue?: number;
1109
+ /** Dark-scheme saturation seed (0–100). Defaults to `saturation`. */
1110
+ darkSaturation?: number;
312
1111
  }
313
1112
  interface GlazeTheme {
314
1113
  /** The hue seed (0–360). */
315
1114
  readonly hue: number;
316
1115
  /** The saturation seed (0–100). */
317
1116
  readonly saturation: number;
1117
+ /** The dark-scheme hue seed (0–360), or `undefined` when `hue` is reused. */
1118
+ readonly darkHue: number | undefined;
1119
+ /** The dark-scheme saturation seed (0–100), or `undefined` when `saturation` is reused. */
1120
+ readonly darkSaturation: number | undefined;
1121
+ /** The effective config for this theme. */
1122
+ getConfig(): GlazeConfigResolved;
318
1123
  /** Add/replace colors (additive merge with existing definitions). */
319
1124
  colors(defs: ColorMap): void;
320
1125
  /** Get a color definition by name. */
@@ -330,7 +1135,7 @@ interface GlazeTheme {
330
1135
  /** Clear all color definitions. */
331
1136
  reset(): void;
332
1137
  /** Export the theme configuration as a JSON-safe object. */
333
- export(): GlazeThemeExport;
1138
+ export(override?: GlazeConfigOverride): GlazeThemeExport;
334
1139
  /** Create a child theme inheriting all color definitions. */
335
1140
  extend(options: GlazeExtendOptions): GlazeTheme;
336
1141
  /** Resolve all colors and return the result map. */
@@ -346,20 +1151,47 @@ interface GlazeTheme {
346
1151
  tokens(options?: GlazeJsonOptions): Record<string, Record<string, string>>;
347
1152
  /**
348
1153
  * Export as tasty style-to-state bindings.
349
- * Uses `#name` color token keys and state aliases (`''`, `@dark`, etc.).
1154
+ * Uses `#name` color token keys and state aliases (`''`, `'@media(prefers-color-scheme: dark)'`, etc.).
350
1155
  * Spread into component styles or register as a recipe via `configure({ recipes })`.
351
- * @see https://cube-ui-kit.vercel.app/?path=/docs/tasty-documentation--docs
1156
+ * @see https://tasty.style/docs
352
1157
  */
353
1158
  tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
354
1159
  /** Export as plain JSON. */
355
1160
  json(options?: GlazeJsonOptions): Record<string, Record<string, string>>;
356
1161
  /** Export as CSS custom property declarations. */
357
1162
  css(options?: GlazeCssOptions): GlazeCssResult;
1163
+ /**
1164
+ * Export as W3C Design Tokens Format Module (2025.10) documents, one per
1165
+ * scheme variant. Consumable by Figma, Tokens Studio, Style Dictionary,
1166
+ * Terrazzo, and any DTCG-compatible tool.
1167
+ * @see https://www.designtokens.org/
1168
+ */
1169
+ dtcg(options?: GlazeDtcgOptions): GlazeDtcgResult;
1170
+ /**
1171
+ * Export as a single W3C DTCG Resolver-Module document describing every
1172
+ * scheme variant as one `sets` entry plus a single `scheme` modifier with a
1173
+ * context per variant. Consumable by resolver tools such as Dispersa.
1174
+ * @see https://www.designtokens.org/
1175
+ */
1176
+ dtcgResolver(options?: GlazeDtcgResolverOptions): GlazeDtcgResolverDocument;
1177
+ /**
1178
+ * Export as a Tailwind CSS v4 `@theme` block (light baseline) plus dark /
1179
+ * high-contrast overrides under configurable selectors. Returns a single
1180
+ * ready-to-paste CSS string.
1181
+ * @see https://tailwindcss.com/docs/theme
1182
+ */
1183
+ tailwind(options?: GlazeTailwindOptions): string;
358
1184
  }
359
1185
  interface GlazeExtendOptions {
360
1186
  hue?: number;
361
1187
  saturation?: number;
1188
+ /** Replace the dark-scheme hue seed (0–360). Defaults to the parent's. */
1189
+ darkHue?: number;
1190
+ /** Replace the dark-scheme saturation seed (0–100). Defaults to the parent's. */
1191
+ darkSaturation?: number;
362
1192
  colors?: ColorMap;
1193
+ /** Config override for the child theme. Merged with the parent's override. */
1194
+ config?: GlazeConfigOverride;
363
1195
  }
364
1196
  interface GlazeTokenOptions {
365
1197
  /** Prefix mode. `true` uses "<themeName>-", or provide a custom map. */
@@ -371,20 +1203,40 @@ interface GlazeTokenOptions {
371
1203
  };
372
1204
  /** Override which scheme variants to include. */
373
1205
  modes?: GlazeOutputModes;
374
- /** Output color format. Default: 'okhsl'. */
1206
+ /** Output color format. Default: 'oklch'. */
375
1207
  format?: GlazeColorFormat;
1208
+ /**
1209
+ * Emit hue as a separate custom property, referenced via `var()`.
1210
+ * Requires `format: 'oklch'` and every color to be pastel.
1211
+ */
1212
+ splitHue?: boolean;
1213
+ /**
1214
+ * Base name for the theme-level hue var (`--{name}-hue`). Default: `'theme'`.
1215
+ * Palette export auto-derives this from the theme name.
1216
+ */
1217
+ name?: string;
376
1218
  }
377
1219
  interface GlazeJsonOptions {
378
1220
  /** Override which scheme variants to include. */
379
1221
  modes?: GlazeOutputModes;
380
- /** Output color format. Default: 'okhsl'. */
1222
+ /** Output color format. Default: 'oklch'. */
381
1223
  format?: GlazeColorFormat;
382
1224
  }
383
1225
  interface GlazeCssOptions {
384
- /** Output color format. Default: 'rgb'. */
1226
+ /** Output color format. Default: 'oklch'. */
385
1227
  format?: GlazeColorFormat;
386
1228
  /** Suffix appended to each CSS custom property name. Default: '-color'. */
387
1229
  suffix?: string;
1230
+ /**
1231
+ * Emit hue as a separate custom property, referenced via `var()`.
1232
+ * Requires `format: 'oklch'` and every color to be pastel.
1233
+ */
1234
+ splitHue?: boolean;
1235
+ /**
1236
+ * Base name for the theme-level hue var (`--{name}-hue`). Default: `'theme'`.
1237
+ * Palette export auto-derives this from the theme name.
1238
+ */
1239
+ name?: string;
388
1240
  }
389
1241
  /** CSS custom property declarations grouped by scheme variant. */
390
1242
  interface GlazeCssResult {
@@ -393,6 +1245,182 @@ interface GlazeCssResult {
393
1245
  lightContrast: string;
394
1246
  darkContrast: string;
395
1247
  }
1248
+ /**
1249
+ * Color space used for DTCG `$value` color objects.
1250
+ * @see https://www.designtokens.org/
1251
+ */
1252
+ type DtcgColorSpace = 'srgb' | 'oklch';
1253
+ /**
1254
+ * A DTCG color `$value` in the sRGB color space: gamma sRGB components in
1255
+ * 0–1 plus a 6-digit `hex` hint. Universally understood by Figma, Tokens
1256
+ * Studio, Style Dictionary, and every DTCG reader.
1257
+ */
1258
+ interface DtcgSrgbColorValue {
1259
+ colorSpace: 'srgb';
1260
+ components: [number, number, number];
1261
+ hex: HexColor;
1262
+ /** Opacity 0–1. Omitted when fully opaque (alpha = 1). */
1263
+ alpha?: number;
1264
+ }
1265
+ /**
1266
+ * A DTCG color `$value` in the OKLCH color space: `[L, C, H]` components
1267
+ * (L/C: 0–1, H: degrees). Wide-gamut and Glaze-native; no `hex` is emitted.
1268
+ */
1269
+ interface DtcgOklchColorValue {
1270
+ colorSpace: 'oklch';
1271
+ components: [number, number, number];
1272
+ /** Opacity 0–1. Omitted when fully opaque (alpha = 1). */
1273
+ alpha?: number;
1274
+ }
1275
+ /** A DTCG `$value` for a color token, in either supported color space. */
1276
+ type DtcgColorValue = DtcgSrgbColorValue | DtcgOklchColorValue;
1277
+ /**
1278
+ * A single W3C DTCG color token: `{ $type: 'color', $value }`.
1279
+ * `$description` is optional and not populated by Glaze today.
1280
+ */
1281
+ interface DtcgColorToken {
1282
+ $type: 'color';
1283
+ $value: DtcgColorValue;
1284
+ $description?: string;
1285
+ }
1286
+ /**
1287
+ * A W3C Design Tokens Format Module (2025.10) token tree for one scheme.
1288
+ * Glaze emits one document per scheme variant — the most tool-compatible
1289
+ * convention (one file per Style Dictionary theme / Tokens Studio set /
1290
+ * Figma variable mode).
1291
+ */
1292
+ type DtcgDocument = Record<string, DtcgColorToken>;
1293
+ /** DTCG token documents grouped by scheme variant. Light is always present. */
1294
+ interface GlazeDtcgResult {
1295
+ light: DtcgDocument;
1296
+ dark?: DtcgDocument;
1297
+ lightContrast?: DtcgDocument;
1298
+ darkContrast?: DtcgDocument;
1299
+ }
1300
+ /** A single DTCG color token grouped by scheme variant (standalone tokens). */
1301
+ interface GlazeColorDtcgResult {
1302
+ light: DtcgColorToken;
1303
+ dark?: DtcgColorToken;
1304
+ lightContrast?: DtcgColorToken;
1305
+ darkContrast?: DtcgColorToken;
1306
+ }
1307
+ /** Options for `theme.dtcg()` / `palette.dtcg()`. */
1308
+ interface GlazeDtcgOptions {
1309
+ /** Override which scheme variants to include. */
1310
+ modes?: GlazeOutputModes;
1311
+ /**
1312
+ * DTCG color space. `'srgb'` (default) emits sRGB components plus a `hex`
1313
+ * hint — universally understood (Figma, Tokens Studio). `'oklch'` emits
1314
+ * OKLCH components with no hex — Glaze-native, wide-gamut.
1315
+ */
1316
+ colorSpace?: DtcgColorSpace;
1317
+ }
1318
+ /**
1319
+ * A node in a DTCG Resolver-Module token tree: either a leaf color token or a
1320
+ * nested group. A flat `DtcgDocument` (top-level color-name keys) is a valid
1321
+ * shallow tree, so Glaze's per-scheme documents slot directly into
1322
+ * `sets.<name>.sources` and `modifiers.<name>.contexts.<ctx>` entries.
1323
+ */
1324
+ interface DtcgTokenTree {
1325
+ [key: string]: DtcgColorToken | DtcgTokenTree;
1326
+ }
1327
+ /** A named set in a resolver document: a list of token-tree sources. */
1328
+ interface DtcgResolverSet {
1329
+ sources: DtcgTokenTree[];
1330
+ }
1331
+ /**
1332
+ * A named modifier (an axis such as `scheme`) in a resolver document.
1333
+ * `default` names the context applied when no override is selected; `contexts`
1334
+ * maps each context name to the token-tree overrides applied for it.
1335
+ */
1336
+ interface DtcgResolverModifier {
1337
+ default: string;
1338
+ contexts: Record<string, DtcgTokenTree[]>;
1339
+ }
1340
+ /** A JSON-pointer `$ref` entry in a resolver document's `resolutionOrder`. */
1341
+ interface DtcgResolverRef {
1342
+ $ref: string;
1343
+ }
1344
+ /**
1345
+ * A W3C DTCG Resolver-Module document. Describes every scheme variant in a
1346
+ * single file as `sets` (base token sources) plus `modifiers` (per-context
1347
+ * overrides) composed in `resolutionOrder`. Consumable by resolver tools such
1348
+ * as Dispersa.
1349
+ * @see https://www.designtokens.org/
1350
+ */
1351
+ interface GlazeDtcgResolverDocument {
1352
+ version: string;
1353
+ sets: Record<string, DtcgResolverSet>;
1354
+ modifiers: Record<string, DtcgResolverModifier>;
1355
+ resolutionOrder: DtcgResolverRef[];
1356
+ }
1357
+ /** Renaming of the four scheme variants as resolver-modifier context names. */
1358
+ interface GlazeDtcgResolverContextNames {
1359
+ light?: string;
1360
+ dark?: string;
1361
+ lightContrast?: string;
1362
+ darkContrast?: string;
1363
+ }
1364
+ /**
1365
+ * Options for `theme.dtcgResolver()` / `palette.dtcgResolver()`. Extends
1366
+ * `GlazeDtcgOptions` so `modes` + `colorSpace` pass through to the underlying
1367
+ * per-scheme `dtcg()` build.
1368
+ */
1369
+ interface GlazeDtcgResolverOptions extends GlazeDtcgOptions {
1370
+ /** Name of the single set holding the default (light) token tree. Default `'base'`. */
1371
+ setName?: string;
1372
+ /**
1373
+ * Name of the modifier describing the scheme axis. Default `'scheme'`
1374
+ * (Glaze's term for the light / dark / high-contrast axis).
1375
+ */
1376
+ modifierName?: string;
1377
+ /**
1378
+ * Override the four context names emitted on the modifier. Defaults to the
1379
+ * Glaze variant keys: `light` / `dark` / `lightContrast` / `darkContrast`.
1380
+ */
1381
+ contextNames?: GlazeDtcgResolverContextNames;
1382
+ /** Resolver document version. Default `'2025.10'`. */
1383
+ version?: string;
1384
+ }
1385
+ /** Options for `glaze.color().dtcgResolver()`. `name` is required. */
1386
+ interface GlazeColorDtcgResolverOptions extends GlazeDtcgResolverOptions {
1387
+ /** Token name keying the color within each token tree. Required. */
1388
+ name: string;
1389
+ }
1390
+ /** Options for `theme.tailwind()` / `palette.tailwind()`. */
1391
+ interface GlazeTailwindOptions {
1392
+ /** Override which scheme variants to include. */
1393
+ modes?: GlazeOutputModes;
1394
+ /** Output color format. Default: 'oklch'. */
1395
+ format?: GlazeColorFormat;
1396
+ /**
1397
+ * CSS custom property namespace, forming `--<namespace><name>`.
1398
+ * Default: `'color-'` → `--color-surface`. (Tailwind v4's `--color-*`
1399
+ * convention, which auto-generates `bg-*` / `text-*` / `border-*`.)
1400
+ *
1401
+ * Named `namespace` rather than `prefix` to avoid clashing with the
1402
+ * palette theme-prefix option on `palette.tailwind()`.
1403
+ */
1404
+ namespace?: string;
1405
+ /**
1406
+ * Selector wrapping the dark-scheme overrides. Default: `'.dark'`.
1407
+ * Pass a media query such as `'@media (prefers-color-scheme: dark)'` to
1408
+ * drive dark mode from the OS preference instead of a class.
1409
+ */
1410
+ darkSelector?: string;
1411
+ /**
1412
+ * Selector wrapping the light high-contrast overrides. Default:
1413
+ * `'.high-contrast'`. The combined dark + high-contrast overrides are
1414
+ * emitted under `${darkSelector}${highContrastSelector}` (e.g.
1415
+ * `.dark.high-contrast`).
1416
+ */
1417
+ highContrastSelector?: string;
1418
+ }
1419
+ /** Options for `glaze.color().tailwind()`. `name` is required. */
1420
+ interface GlazeColorTailwindOptions extends GlazeTailwindOptions {
1421
+ /** Custom property base name (without leading `--`). Required. */
1422
+ name: string;
1423
+ }
396
1424
  /** Options for `glaze.palette()` creation. */
397
1425
  interface GlazePaletteOptions {
398
1426
  /**
@@ -424,8 +1452,31 @@ interface GlazePaletteExportOptions {
424
1452
  * When omitted, inherits the palette-level `primary`.
425
1453
  */
426
1454
  primary?: string | false;
1455
+ /**
1456
+ * Emit hue as a separate custom property, referenced via `var()`.
1457
+ * Requires `format: 'oklch'` and every color to be pastel.
1458
+ */
1459
+ splitHue?: boolean;
427
1460
  }
428
1461
  interface GlazePalette {
1462
+ /** Theme names in insertion order. */
1463
+ list(): string[];
1464
+ /** Primary theme name, if set at palette creation. */
1465
+ readonly primary: string | undefined;
1466
+ /** Get a theme by name. Returns the live instance held by the palette. */
1467
+ theme(name: string): GlazeTheme | undefined;
1468
+ /**
1469
+ * Shallow copy of the theme map (same instances the palette holds).
1470
+ * Mutating a returned theme affects subsequent palette exports.
1471
+ */
1472
+ themes(): Record<string, GlazeTheme>;
1473
+ /**
1474
+ * Export the palette authoring configuration as a JSON-safe object.
1475
+ * Restorable via `glaze.paletteFrom(...)`. Distinct from `json()`, which
1476
+ * emits resolved color strings. Optional `override` is forwarded to each
1477
+ * nested `theme.export(override)`.
1478
+ */
1479
+ export(override?: GlazeConfigOverride): GlazePaletteExport;
429
1480
  /**
430
1481
  * Export all themes as a flat token map grouped by scheme variant.
431
1482
  * Prefix defaults to `true` — all tokens are prefixed with the theme name.
@@ -440,9 +1491,9 @@ interface GlazePalette {
440
1491
  tokens(options?: GlazeJsonOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
441
1492
  /**
442
1493
  * Export all themes as tasty style-to-state bindings.
443
- * Uses `#name` color token keys and state aliases (`''`, `@dark`, etc.).
1494
+ * Uses `#name` color token keys and state aliases (`''`, `'@media(prefers-color-scheme: dark)'`, etc.).
444
1495
  * Prefix defaults to `true`. Inherits the palette-level `primary`.
445
- * @see https://cube-ui-kit.vercel.app/?path=/docs/tasty-documentation--docs
1496
+ * @see https://tasty.style/docs
446
1497
  */
447
1498
  tasty(options?: GlazeTokenOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
448
1499
  /** Export all themes as plain JSON grouped by theme name. */
@@ -451,61 +1502,253 @@ interface GlazePalette {
451
1502
  }): Record<string, Record<string, Record<string, string>>>;
452
1503
  /** Export all themes as CSS custom property declarations. */
453
1504
  css(options?: GlazeCssOptions & GlazePaletteExportOptions): GlazeCssResult;
1505
+ /**
1506
+ * Export all themes as W3C DTCG documents, one per scheme variant.
1507
+ * Prefix defaults to `true`. Inherits the palette-level `primary`.
1508
+ * @see https://www.designtokens.org/
1509
+ */
1510
+ dtcg(options?: GlazeDtcgOptions & GlazePaletteExportOptions): GlazeDtcgResult;
1511
+ /**
1512
+ * Export all themes as a single W3C DTCG Resolver-Module document. Prefix
1513
+ * defaults to `true`. Inherits the palette-level `primary`.
1514
+ * @see https://www.designtokens.org/
1515
+ */
1516
+ dtcgResolver(options?: GlazeDtcgResolverOptions & GlazePaletteExportOptions): GlazeDtcgResolverDocument;
1517
+ /**
1518
+ * Export all themes as a Tailwind CSS v4 `@theme` block plus dark /
1519
+ * high-contrast overrides. Returns a single ready-to-paste CSS string.
1520
+ * Prefix defaults to `true`.
1521
+ * @see https://tailwindcss.com/docs/theme
1522
+ */
1523
+ tailwind(options?: GlazeTailwindOptions & GlazePaletteExportOptions): string;
454
1524
  }
455
1525
  //#endregion
1526
+ //#region src/serialize.d.ts
1527
+ /** Type guard for theme authoring snapshots (prefers `kind`, falls back to shape). */
1528
+ declare function isThemeExport(data: unknown): data is GlazeThemeExport;
1529
+ /** Type guard for color-token authoring snapshots. */
1530
+ declare function isColorTokenExport(data: unknown): data is GlazeColorTokenExport;
1531
+ /** Type guard for palette authoring snapshots. */
1532
+ declare function isPaletteExport(data: unknown): data is GlazePaletteExport;
1533
+ //#endregion
456
1534
  //#region src/glaze.d.ts
457
1535
  type PaletteInput = Record<string, GlazeTheme>;
458
1536
  /**
459
1537
  * Create a single-hue glaze theme.
460
1538
  *
1539
+ * An optional `config` override can be supplied to customize the resolve
1540
+ * behavior for this theme (tone windows, etc.). The
1541
+ * override is **merged over the live global config at resolve time** —
1542
+ * the theme still reacts to later `configure()` calls for fields it
1543
+ * didn't override.
1544
+ *
1545
+ * The object form also accepts `darkHue` / `darkSaturation` — a separate
1546
+ * seed pair for the dark and dark-high-contrast schemes. Both default to
1547
+ * their light counterparts, and an explicit `darkSaturation` opts the theme
1548
+ * out of the global `darkDesaturation` reduction.
1549
+ *
461
1550
  * @example
462
1551
  * ```ts
463
- * const primary = glaze({ hue: 280, saturation: 80 });
464
- * // or shorthand:
465
1552
  * const primary = glaze(280, 80);
1553
+ * // or shorthand:
1554
+ * const primary = glaze({ hue: 280, saturation: 80 });
1555
+ * // with a retuned dark seed:
1556
+ * const primary = glaze({ hue: 280, saturation: 80, darkHue: 268, darkSaturation: 65 });
1557
+ * // with config override:
1558
+ * const raw = glaze(280, 80, { lightTone: false });
466
1559
  * ```
467
1560
  */
468
- declare function glaze(hueOrOptions: number | {
469
- hue: number;
470
- saturation: number;
471
- }, saturation?: number): GlazeTheme;
1561
+ declare function glaze(hueOrOptions: number | GlazeThemeSeed, saturation?: number, config?: GlazeConfigOverride): GlazeTheme;
472
1562
  declare namespace glaze {
473
1563
  var configure: (config: GlazeConfig) => void;
474
- var palette: (themes: PaletteInput, options?: GlazePaletteOptions) => {
475
- tokens(options?: GlazeJsonOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
476
- tasty(options?: GlazeTokenOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
477
- json(options?: GlazeJsonOptions & {
478
- prefix?: boolean | Record<string, string>;
479
- }): Record<string, Record<string, Record<string, string>>>;
480
- css(options?: GlazeCssOptions & GlazePaletteExportOptions): GlazeCssResult;
481
- };
1564
+ var palette: (themes: PaletteInput, options?: GlazePaletteOptions) => GlazePalette;
1565
+ var themeFrom: (data: GlazeThemeExport) => GlazeTheme;
482
1566
  var from: (data: GlazeThemeExport) => GlazeTheme;
483
- var color: (input: GlazeColorInput) => GlazeColorToken;
1567
+ var color: (input: GlazeFromInput | GlazeColorInput | GlazeColorValue, config?: GlazeConfigOverride) => GlazeColorToken;
484
1568
  var shadow: (input: GlazeShadowInput) => ResolvedColorVariant;
485
- var format: (variant: ResolvedColorVariant, colorFormat?: GlazeColorFormat) => string;
1569
+ var format: (variant: ResolvedColorVariant, colorFormat?: GlazeColorFormat, pastel?: boolean) => string;
486
1570
  var fromHex: (hex: string) => GlazeTheme;
487
1571
  var fromRgb: (r: number, g: number, b: number) => GlazeTheme;
1572
+ var colorFrom: (data: GlazeColorTokenExport) => GlazeColorToken;
1573
+ var paletteFrom: (data: GlazePaletteExport) => GlazePalette;
1574
+ var isThemeExport: typeof isThemeExport;
1575
+ var isColorTokenExport: typeof isColorTokenExport;
1576
+ var isPaletteExport: typeof isPaletteExport;
488
1577
  var getConfig: () => GlazeConfigResolved;
489
1578
  var resetConfig: () => void;
490
1579
  }
491
1580
  //#endregion
1581
+ //#region src/channels.d.ts
1582
+ interface HueDeclaration {
1583
+ prop: string;
1584
+ value: string;
1585
+ }
1586
+ interface HuePlan {
1587
+ /** CSS `var()` reference spliced into `oklch(L C <hueVar>)`. */
1588
+ hueVar: string;
1589
+ /** When true, emit a full inline color (shadow/mix/achromatic). */
1590
+ inline: boolean;
1591
+ /** Scheme-independent `--*-hue` declarations for this color. */
1592
+ declarations: HueDeclaration[];
1593
+ }
1594
+ interface ChannelCtx {
1595
+ seedHue: number;
1596
+ /**
1597
+ * Dark-scheme seed hue, when the theme authored one. Drives the dark
1598
+ * `--{baseName}-hue` value; falls back to `seedHue`.
1599
+ */
1600
+ darkSeedHue?: number;
1601
+ /** Theme-level hue var base name (without `--` / `-hue`). */
1602
+ baseName: string;
1603
+ /** Token / custom-property name prefix used for hue var naming (`brand-` etc.). */
1604
+ prefix: string;
1605
+ defs: ColorMap;
1606
+ mode: 'theme' | 'standalone';
1607
+ /** Standalone: resolved hue from the primary variant (scheme-independent). */
1608
+ resolvedHue?: number;
1609
+ /**
1610
+ * When false, hue declarations are not emitted (the pass only references
1611
+ * hue vars already declared by a sibling pass). Used by palette primary
1612
+ * unprefixed aliases so they reference the themed `--{themeName}-*-hue`
1613
+ * vars without re-declaring (and colliding with) other themes' base vars.
1614
+ * Defaults to true.
1615
+ */
1616
+ emitDeclarations?: boolean;
1617
+ }
1618
+ //#endregion
1619
+ //#region src/format-guard.d.ts
1620
+ /**
1621
+ * Throw when a non-native Glaze color space is requested for an export that
1622
+ * emits raw CSS or non-Tasty token maps.
1623
+ */
1624
+ declare function assertNativeFormat(format: GlazeColorFormat | undefined, method: string): void;
1625
+ /**
1626
+ * Throw when `splitHue` is enabled but any exported color is not pastel.
1627
+ * Hue rotation is only clip-free when chroma is bounded by the hue-independent
1628
+ * safe chroma (`computeSafeChromaOKLCH`).
1629
+ */
1630
+ declare function assertAllPastel(resolved: Map<string, ResolvedColor>, modes: Required<GlazeOutputModes>): void;
1631
+ //#endregion
1632
+ //#region src/roles.d.ts
1633
+ /**
1634
+ * Normalize a `RoleInput` (canonical value or alias) into a canonical `Role`.
1635
+ * Returns `undefined` for unrecognized strings so callers can fall through to
1636
+ * the next step of the resolution chain.
1637
+ */
1638
+ declare function normalizeRole(input: RoleInput | undefined): Role | undefined;
1639
+ /**
1640
+ * Infer a `Role` from a color name by matching its tokens against the role
1641
+ * keyword sets. When multiple tokens match, the **last** recognized token
1642
+ * wins (so `button-text` → `text`, `input-bg` → `surface`, `card-border` →
1643
+ * `border`). Returns `undefined` when no token matches.
1644
+ */
1645
+ declare function inferRoleFromName(name: string): Role | undefined;
1646
+ /** APCA argument order: which side the resolved color plays. */
1647
+ type Polarity = 'fg' | 'bg';
1648
+ /**
1649
+ * Map a role to its APCA polarity. `text` and `border` are foreground spots
1650
+ * against their base (the candidate is the text argument); `surface` is the
1651
+ * background (the base is the text argument).
1652
+ */
1653
+ declare function roleToPolarity(role: Role): Polarity;
1654
+ /**
1655
+ * The opposite role of `role`, used when a color with no explicit role and no
1656
+ * inferable name depends on a base: the dependent color plays the opposite
1657
+ * role of its base. `surface` ↔ `text`; `border` is treated as a foreground
1658
+ * spot, so its opposite is `surface`.
1659
+ */
1660
+ declare function oppositeRole(role: Role): Role;
1661
+ //#endregion
1662
+ //#region src/okhst.d.ts
1663
+ /**
1664
+ * Reference eps for the OKHST color space. WCAG 2 contrast is
1665
+ * `(Y_hi + 0.05) / (Y_lo + 0.05)`, so an eps of `0.05` makes equal tone
1666
+ * steps yield equal WCAG contrast. This is the canonical eps used by
1667
+ * `okhst()` input, `{ h, s, t }` input, stored `ResolvedColorVariant.t`,
1668
+ * relative `tone` offsets, and the contrast solver.
1669
+ */
1670
+ declare const REF_EPS = 0.05;
1671
+ /**
1672
+ * Map a luminance `Y` (0–1) to tone (0–100) at the given eps.
1673
+ * `toneFromY(0) === 0` and `toneFromY(1) === 100` for any eps.
1674
+ */
1675
+ declare function toneFromY(y: number, eps?: number): number;
1676
+ /** Map a tone (0–100) back to luminance (0–1). Inverse of {@link toneFromY}. */
1677
+ declare function yFromTone(t: number, eps?: number): number;
1678
+ /** OKHSL lightness (0–1) -> tone (0–100). */
1679
+ declare function toTone(l: number, eps?: number): number;
1680
+ /** Tone (0–100) -> OKHSL lightness (0–1). Inverse of {@link toTone}. */
1681
+ declare function fromTone(t: number, eps?: number): number;
1682
+ /** Convert OKHST `{ h, s, t }` (t in 0–1) to OKHSL `{ h, s, l }`. */
1683
+ declare function okhstToOkhsl(c: {
1684
+ h: number;
1685
+ s: number;
1686
+ t: number;
1687
+ }): {
1688
+ h: number;
1689
+ s: number;
1690
+ l: number;
1691
+ };
1692
+ /** Convert OKHSL `{ h, s, l }` to OKHST `{ h, s, t }` (t in 0–1). */
1693
+ declare function okhslToOkhst(c: {
1694
+ h: number;
1695
+ s: number;
1696
+ l: number;
1697
+ }): {
1698
+ h: number;
1699
+ s: number;
1700
+ t: number;
1701
+ };
1702
+ /**
1703
+ * Edge adapter: a resolved variant stores canonical tone `t` (0–1). Convert
1704
+ * it to the OKHSL `{ h, s, l }` the formatters and luminance pipeline expect —
1705
+ * `s` and `l` on the same 0–1 factor scale, so `const { h, s, l } =
1706
+ * variantToOkhsl(v)` destructures straight into `formatOkhsl` / `formatRgb` /
1707
+ * `okhslToLinearSrgb` with no rescaling. `alpha` stays on the variant; use
1708
+ * `glaze.format(v, format)` for a string that carries it.
1709
+ */
1710
+ declare function variantToOkhsl(v: {
1711
+ h: number;
1712
+ s: number;
1713
+ t: number;
1714
+ }): {
1715
+ h: number;
1716
+ s: number;
1717
+ l: number;
1718
+ };
1719
+ //#endregion
492
1720
  //#region src/okhsl-color-math.d.ts
493
1721
  /**
494
1722
  * OKHSL color math primitives for the glaze theme generator.
495
1723
  *
496
- * Provides bidirectional OKHSL ↔ sRGB conversion, relative luminance
497
- * computation for WCAG 2 contrast calculations, and multi-format output
498
- * (okhsl, rgb, hsl, oklch).
1724
+ * Provides bidirectional OKHSL ↔ sRGB conversion, luminance computation
1725
+ * for both contrast metrics (WCAG 2 relative luminance and APCA screen
1726
+ * luminance `Ys`), and multi-format output (okhsl, rgb, hsl, oklch).
499
1727
  */
1728
+ type Vec3 = [number, number, number];
1729
+ /**
1730
+ * OKHSL toe function: maps OKLab lightness L to perceptual lightness l.
1731
+ * Exported for the OKHST tone transfers in `okhst.ts`.
1732
+ */
1733
+ /**
1734
+ * OKHSL lightness of the gamut cusp for a hue — the lightness where the
1735
+ * realizable chroma peaks. Reuses the same `find_cusp` OKHSL already runs for
1736
+ * its `s` normalization (no new color math); the OKLab cusp lightness is run
1737
+ * through the OKHSL `toe` and clamped to `[0.001, 0.999]` so divisions that
1738
+ * key off it stay safe. Cached per (rounded) hue.
1739
+ *
1740
+ * @param h Hue, 0–360.
1741
+ */
1742
+ declare function cuspLightness(h: number): number;
500
1743
  /**
501
1744
  * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLab [L, a, b].
502
1745
  */
503
- declare function okhslToOklab(h: number, s: number, l: number): [number, number, number];
1746
+ declare function okhslToOklab(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
504
1747
  /**
505
1748
  * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to linear sRGB.
506
1749
  * Channels may exceed [0, 1] near gamut boundaries — caller must clamp if needed.
507
1750
  */
508
- declare function okhslToLinearSrgb(h: number, s: number, l: number): [number, number, number];
1751
+ declare function okhslToLinearSrgb(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
509
1752
  /**
510
1753
  * Compute relative luminance Y from linear sRGB channels.
511
1754
  * Per WCAG 2: Y = 0.2126·R + 0.7152·G + 0.0722·B
@@ -517,45 +1760,92 @@ declare function relativeLuminanceFromLinearRgb(rgb: [number, number, number]):
517
1760
  declare function contrastRatioFromLuminance(yA: number, yB: number): number;
518
1761
  /**
519
1762
  * Convert OKHSL to gamma-encoded sRGB (clamped to 0–1).
1763
+ * h: 0–360, s: 0–1, l: 0–1. Returns [r, g, b] with each channel 0–1.
520
1764
  */
521
- declare function okhslToSrgb(h: number, s: number, l: number): [number, number, number];
1765
+ declare function okhslToSrgb(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
522
1766
  /**
523
1767
  * Compute WCAG 2 relative luminance from linear sRGB, matching the browser
524
1768
  * rendering pipeline: gamma-encode, clamp to sRGB gamut [0,1], then linearize.
525
1769
  * This avoids over/under-estimating luminance for out-of-gamut OKHSL colors.
526
1770
  */
527
1771
  declare function gamutClampedLuminance(linearRgb: [number, number, number]): number;
1772
+ /**
1773
+ * Convert OKLab to OKHSL.
1774
+ * Input: [L, a, b] where L: 0–1, a/b: roughly -0.5 to 0.5.
1775
+ * Returns [h, s, l] where h: 0–360, s: 0–1, l: 0–1.
1776
+ */
1777
+ declare const oklabToOkhsl: (lab: Vec3, pastel?: boolean) => Vec3;
528
1778
  /**
529
1779
  * Convert gamma-encoded sRGB (0–1 per channel) to OKHSL.
530
1780
  * Returns [h, s, l] where h: 0–360, s: 0–1, l: 0–1.
531
1781
  */
532
- declare function srgbToOkhsl(rgb: [number, number, number]): [number, number, number];
1782
+ declare function srgbToOkhsl(rgb: [number, number, number], pastel?: boolean): [number, number, number];
1783
+ /**
1784
+ * Convert CSS HSL (sRGB-based) to gamma-encoded sRGB [r, g, b] in 0–1 range.
1785
+ * h: 0–360, s: 0–1, l: 0–1.
1786
+ *
1787
+ * Note: CSS HSL is not the same as OKHSL — it's HSL in the sRGB color space.
1788
+ * Use this when parsing `hsl(...)` strings before passing to `srgbToOkhsl`.
1789
+ */
1790
+ declare function hslToSrgb(h: number, s: number, l: number): [number, number, number];
533
1791
  /**
534
1792
  * Parse a hex color string (#rgb or #rrggbb) to sRGB [r, g, b] in 0–1 range.
535
1793
  * Returns null if the string is not a valid hex color.
1794
+ *
1795
+ * For 8-digit hex (`#rrggbbaa`) and 4-digit hex (`#rgba`) with alpha,
1796
+ * use {@link parseHexAlpha}.
536
1797
  */
537
1798
  declare function parseHex(hex: string): [number, number, number] | null;
1799
+ /**
1800
+ * Parse a hex color string (#rgb, #rrggbb, #rgba, or #rrggbbaa) to
1801
+ * sRGB [r, g, b] in 0–1 range plus an optional alpha (0–1).
1802
+ * Returns null if the string is not a valid hex color.
1803
+ */
1804
+ declare function parseHexAlpha(hex: string): {
1805
+ rgb: [number, number, number];
1806
+ alpha?: number;
1807
+ } | null;
538
1808
  /**
539
1809
  * Format OKHSL values as a CSS `okhsl(H S% L%)` string.
540
- * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
1810
+ * h: 0–360, s: 0–1, l: 0–1 (factor scale, as returned by every converter).
541
1811
  */
542
- declare function formatOkhsl(h: number, s: number, l: number): string;
1812
+ declare function formatOkhsl(h: number, s: number, l: number, pastel?: boolean): string;
1813
+ /**
1814
+ * Format OKHST values as a CSS `okhst(H S% T%)` string.
1815
+ * h: 0–360, s: 0–1, t: 0–1 (factor scale, matching `ResolvedColorVariant`).
1816
+ *
1817
+ * Pastel recompute matches `formatOkhsl`: convert via OKLab so external
1818
+ * parsers that only understand non-pastel OKHST render identically.
1819
+ */
1820
+ declare function formatOkhst(h: number, s: number, t: number, pastel?: boolean): string;
543
1821
  /**
544
1822
  * Format OKHSL values as a CSS `rgb(R G B)` string.
545
1823
  * Uses 2 decimal places to avoid 8-bit quantization contrast loss.
546
- * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
1824
+ * h: 0–360, s: 0–1, l: 0–1 (factor scale, as returned by every converter).
547
1825
  */
548
- declare function formatRgb(h: number, s: number, l: number): string;
1826
+ declare function formatRgb(h: number, s: number, l: number, pastel?: boolean): string;
549
1827
  /**
550
1828
  * Format OKHSL values as a CSS `hsl(H S% L%)` string.
551
- * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
1829
+ * h: 0–360, s: 0–1, l: 0–1 (factor scale, as returned by every converter).
552
1830
  */
553
- declare function formatHsl(h: number, s: number, l: number): string;
1831
+ declare function formatHsl(h: number, s: number, l: number, pastel?: boolean): string;
554
1832
  /**
555
1833
  * Format OKHSL values as a CSS `oklch(L C H)` string.
556
- * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
1834
+ * h: 0–360, s: 0–1, l: 0–1 (factor scale, as returned by every converter).
1835
+ */
1836
+ declare function formatOklch(h: number, s: number, l: number, pastel?: boolean): string;
1837
+ /**
1838
+ * Convert gamma-encoded sRGB channels (0–1) to a 6-digit lowercase hex
1839
+ * string (`#rrggbb`). Channels are clamped to [0,1] and rounded to 8-bit.
1840
+ * Alpha is not encoded here — DTCG carries it as a separate `alpha` field.
1841
+ */
1842
+ declare function srgbToHex(rgb: [number, number, number]): `#${string}`;
1843
+ /**
1844
+ * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLCH components `[L, C, H]`.
1845
+ * L: 0–1, C: 0–~0.4 (chroma), H: 0–360 (hue). Shared by `formatOklch` and
1846
+ * the DTCG `oklch` colorSpace exporter so the two never drift apart.
557
1847
  */
558
- declare function formatOklch(h: number, s: number, l: number): string;
1848
+ declare function okhslToOklch(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
559
1849
  //#endregion
560
- export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type FindLightnessForContrastOptions, type FindLightnessForContrastResult, type FindValueForMixContrastOptions, type FindValueForMixContrastResult, type GlazeColorFormat, type GlazeColorInput, type GlazeColorToken, type GlazeConfig, type GlazeCssOptions, type GlazeCssResult, type GlazeExtendOptions, 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 RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type ShadowColorDef, type ShadowTuning, contrastRatioFromLuminance, findLightnessForContrast, findValueForMixContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, gamutClampedLuminance, glaze, okhslToLinearSrgb, okhslToOklab, okhslToSrgb, parseHex, relativeLuminanceFromLinearRgb, resolveMinContrast, srgbToOkhsl };
1850
+ 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 GlazeJsonOptions, type GlazeOutputModes, type GlazePalette, type GlazePaletteExport, type GlazePaletteExportOptions, type GlazePaletteOptions, type GlazeShadowInput, type GlazeTailwindOptions, type GlazeTheme, type GlazeThemeExport, type GlazeThemeSeed, type GlazeTokenOptions, type HCPair, type HexColor, type HueDeclaration, type HuePlan, 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, 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 };
561
1851
  //# sourceMappingURL=index.d.mts.map