@tenphi/glaze 0.0.0-snapshot.304844 → 0.0.0-snapshot.38d4d4e

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