@tenphi/glaze 0.0.0-snapshot.7c1fc7d → 0.0.0-snapshot.7e2a1da

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.cts CHANGED
@@ -6,6 +6,7 @@
6
6
  * against a base color. Used by glaze when resolving dependent colors
7
7
  * with `contrast`.
8
8
  */
9
+ type LinearRgb = [number, number, number];
9
10
  type ContrastPreset = 'AA' | 'AAA' | 'AA-large' | 'AAA-large';
10
11
  type MinContrast$1 = number | ContrastPreset;
11
12
  interface FindLightnessForContrastOptions {
@@ -42,6 +43,39 @@ declare function resolveMinContrast(value: MinContrast$1): number;
42
43
  * against a base color, staying as close to `preferredLightness` as possible.
43
44
  */
44
45
  declare function findLightnessForContrast(options: FindLightnessForContrastOptions): FindLightnessForContrastResult;
46
+ interface FindValueForMixContrastOptions {
47
+ /** Preferred mix parameter (0–1). */
48
+ preferredValue: number;
49
+ /** Base color as linear sRGB. */
50
+ baseLinearRgb: LinearRgb;
51
+ /** Target color as linear sRGB. */
52
+ 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
+ */
60
+ luminanceAtValue: (t: number) => number;
61
+ /** Convergence threshold. Default: 1e-4. */
62
+ epsilon?: number;
63
+ /** Maximum binary-search iterations per branch. Default: 20. */
64
+ maxIterations?: number;
65
+ }
66
+ interface FindValueForMixContrastResult {
67
+ /** Chosen mix parameter (0–1). */
68
+ value: number;
69
+ /** Achieved WCAG contrast ratio. */
70
+ contrast: number;
71
+ /** Whether the target was reached. */
72
+ met: boolean;
73
+ }
74
+ /**
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.
77
+ */
78
+ declare function findValueForMixContrast(options: FindValueForMixContrastOptions): FindValueForMixContrastResult;
45
79
  //#endregion
46
80
  //#region src/types.d.ts
47
81
  /** A value or [normal, high-contrast] pair. */
@@ -144,7 +178,41 @@ interface ShadowColorDef {
144
178
  /** Override default tuning. Merged field-by-field with global `shadowTuning`. */
145
179
  tuning?: ShadowTuning;
146
180
  }
147
- type ColorDef = RegularColorDef | ShadowColorDef;
181
+ interface MixColorDef {
182
+ type: 'mix';
183
+ /** Background/base color name — the "from" color. */
184
+ base: string;
185
+ /** Target color name — the "to" color to mix toward. */
186
+ target: string;
187
+ /**
188
+ * Mix ratio 0–100 (0 = pure base, 100 = pure target).
189
+ * In 'transparent' blend mode, this controls the opacity of the target.
190
+ * Supports [normal, highContrast] pair.
191
+ */
192
+ value: HCPair<number>;
193
+ /**
194
+ * Blending mode. Default: 'opaque'.
195
+ * - 'opaque': produces a solid color by interpolating base and target.
196
+ * - 'transparent': produces the target color with alpha = value/100.
197
+ */
198
+ blend?: 'opaque' | 'transparent';
199
+ /**
200
+ * Interpolation color space for opaque blending. Default: 'okhsl'.
201
+ * - 'okhsl': perceptually uniform, consistent with Glaze's internal model.
202
+ * - 'srgb': linear sRGB interpolation, matches browser compositing.
203
+ *
204
+ * Ignored for 'transparent' blend (always composites in linear sRGB).
205
+ */
206
+ space?: 'okhsl' | 'srgb';
207
+ /**
208
+ * Minimum WCAG contrast between the base and the resulting color.
209
+ * In 'opaque' mode, adjusts the mix ratio to meet contrast.
210
+ * In 'transparent' mode, adjusts opacity to meet contrast against the composite.
211
+ * Supports [normal, highContrast] pair.
212
+ */
213
+ contrast?: HCPair<MinContrast>;
214
+ }
215
+ type ColorDef = RegularColorDef | ShadowColorDef | MixColorDef;
148
216
  type ColorMap = Record<string, ColorDef>;
149
217
  /** Resolved color for a single scheme variant. */
150
218
  interface ResolvedColorVariant {
@@ -174,6 +242,12 @@ interface GlazeConfig {
174
242
  darkLightness?: [number, number];
175
243
  /** Saturation reduction factor for dark scheme (0–1). Default: 0.1. */
176
244
  darkDesaturation?: number;
245
+ /**
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.
249
+ */
250
+ darkCurve?: number;
177
251
  /** State alias names for token export. */
178
252
  states?: {
179
253
  dark?: string;
@@ -188,6 +262,7 @@ interface GlazeConfigResolved {
188
262
  lightLightness: [number, number];
189
263
  darkLightness: [number, number];
190
264
  darkDesaturation: number;
265
+ darkCurve: number;
191
266
  states: {
192
267
  dark: string;
193
268
  highContrast: string;
@@ -317,33 +392,54 @@ interface GlazeCssResult {
317
392
  lightContrast: string;
318
393
  darkContrast: string;
319
394
  }
395
+ /** Options shared by palette `tokens()`, `tasty()`, and `css()` exports. */
396
+ interface GlazePaletteExportOptions {
397
+ /**
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).
401
+ */
402
+ prefix?: boolean | Record<string, string>;
403
+ /**
404
+ * Name of the primary theme. The primary theme's tokens are duplicated
405
+ * without prefix, providing convenient short aliases alongside the
406
+ * prefixed versions.
407
+ *
408
+ * @example
409
+ * ```ts
410
+ * palette.tokens({ primary: 'brand' })
411
+ * // → { light: { 'brand-surface': '...', 'surface': '...', 'accent-surface': '...' } }
412
+ * ```
413
+ */
414
+ primary?: string;
415
+ }
320
416
  interface GlazePalette {
321
417
  /**
322
418
  * Export all themes as a flat token map grouped by scheme variant.
419
+ * Prefix defaults to `true` — all tokens are prefixed with the theme name.
420
+ * Use `primary` to duplicate one theme's tokens without prefix.
323
421
  *
324
422
  * ```ts
325
- * palette.tokens({ prefix: true })
326
- * // → { light: { 'primary-surface': 'okhsl(...)' }, dark: { 'primary-surface': 'okhsl(...)' } }
423
+ * palette.tokens({ primary: 'brand' })
424
+ * // → { light: { 'brand-surface': '...', 'surface': '...', 'accent-surface': '...' } }
327
425
  * ```
328
426
  */
329
- tokens(options?: GlazeJsonOptions & {
330
- prefix?: boolean | Record<string, string>;
331
- }): Record<string, Record<string, string>>;
427
+ tokens(options?: GlazeJsonOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
332
428
  /**
333
429
  * Export all themes as tasty style-to-state bindings.
334
430
  * Uses `#name` color token keys and state aliases (`''`, `@dark`, etc.).
335
- * Spread into component styles or register as a recipe via `configure({ recipes })`.
431
+ * Prefix defaults to `true`. Use `primary` to duplicate one theme without prefix.
336
432
  * @see https://cube-ui-kit.vercel.app/?path=/docs/tasty-documentation--docs
337
433
  */
338
- tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
339
- /** Export all themes as plain JSON. */
434
+ tasty(options?: GlazeTokenOptions & {
435
+ primary?: string;
436
+ }): Record<string, Record<string, string>>;
437
+ /** Export all themes as plain JSON grouped by theme name. */
340
438
  json(options?: GlazeJsonOptions & {
341
439
  prefix?: boolean | Record<string, string>;
342
440
  }): Record<string, Record<string, Record<string, string>>>;
343
441
  /** Export all themes as CSS custom property declarations. */
344
- css(options?: GlazeCssOptions & {
345
- prefix?: boolean | Record<string, string>;
346
- }): GlazeCssResult;
442
+ css(options?: GlazeCssOptions & GlazePaletteExportOptions): GlazeCssResult;
347
443
  }
348
444
  //#endregion
349
445
  //#region src/glaze.d.ts
@@ -365,16 +461,14 @@ declare function glaze(hueOrOptions: number | {
365
461
  declare namespace glaze {
366
462
  var configure: (config: GlazeConfig) => void;
367
463
  var palette: (themes: PaletteInput) => {
368
- tokens(options?: GlazeJsonOptions & {
369
- prefix?: boolean | Record<string, string>;
464
+ tokens(options?: GlazeJsonOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
465
+ tasty(options?: GlazeTokenOptions & {
466
+ primary?: string;
370
467
  }): Record<string, Record<string, string>>;
371
- tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
372
468
  json(options?: GlazeJsonOptions & {
373
469
  prefix?: boolean | Record<string, string>;
374
470
  }): Record<string, Record<string, Record<string, string>>>;
375
- css(options?: GlazeCssOptions & {
376
- prefix?: boolean | Record<string, string>;
377
- }): GlazeCssResult;
471
+ css(options?: GlazeCssOptions & GlazePaletteExportOptions): GlazeCssResult;
378
472
  };
379
473
  var from: (data: GlazeThemeExport) => GlazeTheme;
380
474
  var color: (input: GlazeColorInput) => GlazeColorToken;
@@ -394,6 +488,10 @@ declare namespace glaze {
394
488
  * computation for WCAG 2 contrast calculations, and multi-format output
395
489
  * (okhsl, rgb, hsl, oklch).
396
490
  */
491
+ /**
492
+ * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLab [L, a, b].
493
+ */
494
+ declare function okhslToOklab(h: number, s: number, l: number): [number, number, number];
397
495
  /**
398
496
  * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to linear sRGB.
399
497
  * Channels may exceed [0, 1] near gamut boundaries — caller must clamp if needed.
@@ -413,9 +511,11 @@ declare function contrastRatioFromLuminance(yA: number, yB: number): number;
413
511
  */
414
512
  declare function okhslToSrgb(h: number, s: number, l: number): [number, number, number];
415
513
  /**
416
- * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLab [L, a, b].
514
+ * Compute WCAG 2 relative luminance from linear sRGB, matching the browser
515
+ * rendering pipeline: gamma-encode, clamp to sRGB gamut [0,1], then linearize.
516
+ * This avoids over/under-estimating luminance for out-of-gamut OKHSL colors.
417
517
  */
418
- declare function okhslToOklab(h: number, s: number, l: number): [number, number, number];
518
+ declare function gamutClampedLuminance(linearRgb: [number, number, number]): number;
419
519
  /**
420
520
  * Convert gamma-encoded sRGB (0–1 per channel) to OKHSL.
421
521
  * Returns [h, s, l] where h: 0–360, s: 0–1, l: 0–1.
@@ -432,7 +532,8 @@ declare function parseHex(hex: string): [number, number, number] | null;
432
532
  */
433
533
  declare function formatOkhsl(h: number, s: number, l: number): string;
434
534
  /**
435
- * Format OKHSL values as a CSS `rgb(R G B)` string with rounded integer values.
535
+ * Format OKHSL values as a CSS `rgb(R G B)` string.
536
+ * Uses 2 decimal places to avoid 8-bit quantization contrast loss.
436
537
  * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
437
538
  */
438
539
  declare function formatRgb(h: number, s: number, l: number): string;
@@ -447,5 +548,5 @@ declare function formatHsl(h: number, s: number, l: number): string;
447
548
  */
448
549
  declare function formatOklch(h: number, s: number, l: number): string;
449
550
  //#endregion
450
- export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type FindLightnessForContrastOptions, type FindLightnessForContrastResult, type GlazeColorFormat, type GlazeColorInput, type GlazeColorToken, type GlazeConfig, type GlazeCssOptions, type GlazeCssResult, type GlazeExtendOptions, type GlazeJsonOptions, type GlazeOutputModes, type GlazePalette, type GlazeShadowInput, type GlazeTheme, type GlazeThemeExport, type GlazeTokenOptions, type HCPair, type HexColor, type MinContrast, type OkhslColor, type RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type ShadowColorDef, type ShadowTuning, contrastRatioFromLuminance, findLightnessForContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, glaze, okhslToLinearSrgb, okhslToOklab, okhslToSrgb, parseHex, relativeLuminanceFromLinearRgb, resolveMinContrast, srgbToOkhsl };
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 };
451
552
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -6,6 +6,7 @@
6
6
  * against a base color. Used by glaze when resolving dependent colors
7
7
  * with `contrast`.
8
8
  */
9
+ type LinearRgb = [number, number, number];
9
10
  type ContrastPreset = 'AA' | 'AAA' | 'AA-large' | 'AAA-large';
10
11
  type MinContrast$1 = number | ContrastPreset;
11
12
  interface FindLightnessForContrastOptions {
@@ -42,6 +43,39 @@ declare function resolveMinContrast(value: MinContrast$1): number;
42
43
  * against a base color, staying as close to `preferredLightness` as possible.
43
44
  */
44
45
  declare function findLightnessForContrast(options: FindLightnessForContrastOptions): FindLightnessForContrastResult;
46
+ interface FindValueForMixContrastOptions {
47
+ /** Preferred mix parameter (0–1). */
48
+ preferredValue: number;
49
+ /** Base color as linear sRGB. */
50
+ baseLinearRgb: LinearRgb;
51
+ /** Target color as linear sRGB. */
52
+ 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
+ */
60
+ luminanceAtValue: (t: number) => number;
61
+ /** Convergence threshold. Default: 1e-4. */
62
+ epsilon?: number;
63
+ /** Maximum binary-search iterations per branch. Default: 20. */
64
+ maxIterations?: number;
65
+ }
66
+ interface FindValueForMixContrastResult {
67
+ /** Chosen mix parameter (0–1). */
68
+ value: number;
69
+ /** Achieved WCAG contrast ratio. */
70
+ contrast: number;
71
+ /** Whether the target was reached. */
72
+ met: boolean;
73
+ }
74
+ /**
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.
77
+ */
78
+ declare function findValueForMixContrast(options: FindValueForMixContrastOptions): FindValueForMixContrastResult;
45
79
  //#endregion
46
80
  //#region src/types.d.ts
47
81
  /** A value or [normal, high-contrast] pair. */
@@ -144,7 +178,41 @@ interface ShadowColorDef {
144
178
  /** Override default tuning. Merged field-by-field with global `shadowTuning`. */
145
179
  tuning?: ShadowTuning;
146
180
  }
147
- type ColorDef = RegularColorDef | ShadowColorDef;
181
+ interface MixColorDef {
182
+ type: 'mix';
183
+ /** Background/base color name — the "from" color. */
184
+ base: string;
185
+ /** Target color name — the "to" color to mix toward. */
186
+ target: string;
187
+ /**
188
+ * Mix ratio 0–100 (0 = pure base, 100 = pure target).
189
+ * In 'transparent' blend mode, this controls the opacity of the target.
190
+ * Supports [normal, highContrast] pair.
191
+ */
192
+ value: HCPair<number>;
193
+ /**
194
+ * Blending mode. Default: 'opaque'.
195
+ * - 'opaque': produces a solid color by interpolating base and target.
196
+ * - 'transparent': produces the target color with alpha = value/100.
197
+ */
198
+ blend?: 'opaque' | 'transparent';
199
+ /**
200
+ * Interpolation color space for opaque blending. Default: 'okhsl'.
201
+ * - 'okhsl': perceptually uniform, consistent with Glaze's internal model.
202
+ * - 'srgb': linear sRGB interpolation, matches browser compositing.
203
+ *
204
+ * Ignored for 'transparent' blend (always composites in linear sRGB).
205
+ */
206
+ space?: 'okhsl' | 'srgb';
207
+ /**
208
+ * Minimum WCAG contrast between the base and the resulting color.
209
+ * In 'opaque' mode, adjusts the mix ratio to meet contrast.
210
+ * In 'transparent' mode, adjusts opacity to meet contrast against the composite.
211
+ * Supports [normal, highContrast] pair.
212
+ */
213
+ contrast?: HCPair<MinContrast>;
214
+ }
215
+ type ColorDef = RegularColorDef | ShadowColorDef | MixColorDef;
148
216
  type ColorMap = Record<string, ColorDef>;
149
217
  /** Resolved color for a single scheme variant. */
150
218
  interface ResolvedColorVariant {
@@ -174,6 +242,12 @@ interface GlazeConfig {
174
242
  darkLightness?: [number, number];
175
243
  /** Saturation reduction factor for dark scheme (0–1). Default: 0.1. */
176
244
  darkDesaturation?: number;
245
+ /**
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.
249
+ */
250
+ darkCurve?: number;
177
251
  /** State alias names for token export. */
178
252
  states?: {
179
253
  dark?: string;
@@ -188,6 +262,7 @@ interface GlazeConfigResolved {
188
262
  lightLightness: [number, number];
189
263
  darkLightness: [number, number];
190
264
  darkDesaturation: number;
265
+ darkCurve: number;
191
266
  states: {
192
267
  dark: string;
193
268
  highContrast: string;
@@ -317,33 +392,54 @@ interface GlazeCssResult {
317
392
  lightContrast: string;
318
393
  darkContrast: string;
319
394
  }
395
+ /** Options shared by palette `tokens()`, `tasty()`, and `css()` exports. */
396
+ interface GlazePaletteExportOptions {
397
+ /**
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).
401
+ */
402
+ prefix?: boolean | Record<string, string>;
403
+ /**
404
+ * Name of the primary theme. The primary theme's tokens are duplicated
405
+ * without prefix, providing convenient short aliases alongside the
406
+ * prefixed versions.
407
+ *
408
+ * @example
409
+ * ```ts
410
+ * palette.tokens({ primary: 'brand' })
411
+ * // → { light: { 'brand-surface': '...', 'surface': '...', 'accent-surface': '...' } }
412
+ * ```
413
+ */
414
+ primary?: string;
415
+ }
320
416
  interface GlazePalette {
321
417
  /**
322
418
  * Export all themes as a flat token map grouped by scheme variant.
419
+ * Prefix defaults to `true` — all tokens are prefixed with the theme name.
420
+ * Use `primary` to duplicate one theme's tokens without prefix.
323
421
  *
324
422
  * ```ts
325
- * palette.tokens({ prefix: true })
326
- * // → { light: { 'primary-surface': 'okhsl(...)' }, dark: { 'primary-surface': 'okhsl(...)' } }
423
+ * palette.tokens({ primary: 'brand' })
424
+ * // → { light: { 'brand-surface': '...', 'surface': '...', 'accent-surface': '...' } }
327
425
  * ```
328
426
  */
329
- tokens(options?: GlazeJsonOptions & {
330
- prefix?: boolean | Record<string, string>;
331
- }): Record<string, Record<string, string>>;
427
+ tokens(options?: GlazeJsonOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
332
428
  /**
333
429
  * Export all themes as tasty style-to-state bindings.
334
430
  * Uses `#name` color token keys and state aliases (`''`, `@dark`, etc.).
335
- * Spread into component styles or register as a recipe via `configure({ recipes })`.
431
+ * Prefix defaults to `true`. Use `primary` to duplicate one theme without prefix.
336
432
  * @see https://cube-ui-kit.vercel.app/?path=/docs/tasty-documentation--docs
337
433
  */
338
- tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
339
- /** Export all themes as plain JSON. */
434
+ tasty(options?: GlazeTokenOptions & {
435
+ primary?: string;
436
+ }): Record<string, Record<string, string>>;
437
+ /** Export all themes as plain JSON grouped by theme name. */
340
438
  json(options?: GlazeJsonOptions & {
341
439
  prefix?: boolean | Record<string, string>;
342
440
  }): Record<string, Record<string, Record<string, string>>>;
343
441
  /** Export all themes as CSS custom property declarations. */
344
- css(options?: GlazeCssOptions & {
345
- prefix?: boolean | Record<string, string>;
346
- }): GlazeCssResult;
442
+ css(options?: GlazeCssOptions & GlazePaletteExportOptions): GlazeCssResult;
347
443
  }
348
444
  //#endregion
349
445
  //#region src/glaze.d.ts
@@ -365,16 +461,14 @@ declare function glaze(hueOrOptions: number | {
365
461
  declare namespace glaze {
366
462
  var configure: (config: GlazeConfig) => void;
367
463
  var palette: (themes: PaletteInput) => {
368
- tokens(options?: GlazeJsonOptions & {
369
- prefix?: boolean | Record<string, string>;
464
+ tokens(options?: GlazeJsonOptions & GlazePaletteExportOptions): Record<string, Record<string, string>>;
465
+ tasty(options?: GlazeTokenOptions & {
466
+ primary?: string;
370
467
  }): Record<string, Record<string, string>>;
371
- tasty(options?: GlazeTokenOptions): Record<string, Record<string, string>>;
372
468
  json(options?: GlazeJsonOptions & {
373
469
  prefix?: boolean | Record<string, string>;
374
470
  }): Record<string, Record<string, Record<string, string>>>;
375
- css(options?: GlazeCssOptions & {
376
- prefix?: boolean | Record<string, string>;
377
- }): GlazeCssResult;
471
+ css(options?: GlazeCssOptions & GlazePaletteExportOptions): GlazeCssResult;
378
472
  };
379
473
  var from: (data: GlazeThemeExport) => GlazeTheme;
380
474
  var color: (input: GlazeColorInput) => GlazeColorToken;
@@ -394,6 +488,10 @@ declare namespace glaze {
394
488
  * computation for WCAG 2 contrast calculations, and multi-format output
395
489
  * (okhsl, rgb, hsl, oklch).
396
490
  */
491
+ /**
492
+ * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLab [L, a, b].
493
+ */
494
+ declare function okhslToOklab(h: number, s: number, l: number): [number, number, number];
397
495
  /**
398
496
  * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to linear sRGB.
399
497
  * Channels may exceed [0, 1] near gamut boundaries — caller must clamp if needed.
@@ -413,9 +511,11 @@ declare function contrastRatioFromLuminance(yA: number, yB: number): number;
413
511
  */
414
512
  declare function okhslToSrgb(h: number, s: number, l: number): [number, number, number];
415
513
  /**
416
- * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLab [L, a, b].
514
+ * Compute WCAG 2 relative luminance from linear sRGB, matching the browser
515
+ * rendering pipeline: gamma-encode, clamp to sRGB gamut [0,1], then linearize.
516
+ * This avoids over/under-estimating luminance for out-of-gamut OKHSL colors.
417
517
  */
418
- declare function okhslToOklab(h: number, s: number, l: number): [number, number, number];
518
+ declare function gamutClampedLuminance(linearRgb: [number, number, number]): number;
419
519
  /**
420
520
  * Convert gamma-encoded sRGB (0–1 per channel) to OKHSL.
421
521
  * Returns [h, s, l] where h: 0–360, s: 0–1, l: 0–1.
@@ -432,7 +532,8 @@ declare function parseHex(hex: string): [number, number, number] | null;
432
532
  */
433
533
  declare function formatOkhsl(h: number, s: number, l: number): string;
434
534
  /**
435
- * Format OKHSL values as a CSS `rgb(R G B)` string with rounded integer values.
535
+ * Format OKHSL values as a CSS `rgb(R G B)` string.
536
+ * Uses 2 decimal places to avoid 8-bit quantization contrast loss.
436
537
  * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
437
538
  */
438
539
  declare function formatRgb(h: number, s: number, l: number): string;
@@ -447,5 +548,5 @@ declare function formatHsl(h: number, s: number, l: number): string;
447
548
  */
448
549
  declare function formatOklch(h: number, s: number, l: number): string;
449
550
  //#endregion
450
- export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type FindLightnessForContrastOptions, type FindLightnessForContrastResult, type GlazeColorFormat, type GlazeColorInput, type GlazeColorToken, type GlazeConfig, type GlazeCssOptions, type GlazeCssResult, type GlazeExtendOptions, type GlazeJsonOptions, type GlazeOutputModes, type GlazePalette, type GlazeShadowInput, type GlazeTheme, type GlazeThemeExport, type GlazeTokenOptions, type HCPair, type HexColor, type MinContrast, type OkhslColor, type RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type ShadowColorDef, type ShadowTuning, contrastRatioFromLuminance, findLightnessForContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, glaze, okhslToLinearSrgb, okhslToOklab, okhslToSrgb, parseHex, relativeLuminanceFromLinearRgb, resolveMinContrast, srgbToOkhsl };
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 };
451
552
  //# sourceMappingURL=index.d.mts.map