@tenphi/glaze 0.14.0 → 0.15.1

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
@@ -41,13 +41,8 @@ interface FindToneForContrastOptions {
41
41
  initialDirection?: 'lighter' | 'darker';
42
42
  /** Auto-flip tone direction when contrast can't be met. Default: false. */
43
43
  flip?: boolean;
44
- /**
45
- * Saturation taper strength (0–1). When set, candidate saturation is rolled
46
- * off toward the tone extremes via the same envelope the renderer applies,
47
- * so the solved tone meets the floor with its *rendered* saturation. Default
48
- * `0` (no taper) for direct/advanced callers.
49
- */
50
- saturationTaper?: number;
44
+ /** Use the hue-independent "safe" chroma boundary. Default: false. */
45
+ pastel?: boolean;
51
46
  }
52
47
  interface FindToneForContrastResult {
53
48
  /** Chosen tone in 0–1. */
@@ -222,6 +217,13 @@ interface RegularColorDef {
222
217
  * should not be combined (a console.warn is emitted).
223
218
  */
224
219
  opacity?: number;
220
+ /**
221
+ * Per-color override for the hue-independent "safe" chroma limit used in
222
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
223
+ * Falls through to the global / per-theme `pastel` config when omitted.
224
+ * @see GlazeConfig.pastel
225
+ */
226
+ pastel?: boolean;
225
227
  /**
226
228
  * Whether this color is inherited by child themes created via `extend()`.
227
229
  * Default: true. Set to false to make this color local to the current theme.
@@ -271,6 +273,13 @@ interface ShadowColorDef {
271
273
  intensity: HCPair<number>;
272
274
  /** Override default tuning. Merged field-by-field with global `shadowTuning`. */
273
275
  tuning?: ShadowTuning;
276
+ /**
277
+ * Per-color override for the hue-independent "safe" chroma limit used in
278
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
279
+ * Falls through to the global / per-theme `pastel` config when omitted.
280
+ * @see GlazeConfig.pastel
281
+ */
282
+ pastel?: boolean;
274
283
  /**
275
284
  * Whether this color is inherited by child themes created via `extend()`.
276
285
  * Default: true. Set to false to make this color local to the current theme.
@@ -311,6 +320,13 @@ interface MixColorDef {
311
320
  * metric. Supports [normal, highContrast] pair.
312
321
  */
313
322
  contrast?: HCPair<ContrastSpec>;
323
+ /**
324
+ * Per-color override for the hue-independent "safe" chroma limit used in
325
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
326
+ * Falls through to the global / per-theme `pastel` config when omitted.
327
+ * @see GlazeConfig.pastel
328
+ */
329
+ pastel?: boolean;
314
330
  /**
315
331
  * Whether this color is inherited by child themes created via `extend()`.
316
332
  * Default: true. Set to false to make this color local to the current theme.
@@ -335,6 +351,12 @@ interface ResolvedColorVariant {
335
351
  t: number;
336
352
  /** Opacity (0–1). Default: 1. */
337
353
  alpha: number;
354
+ /**
355
+ * Effective `pastel` flag used while resolving this variant (author def or
356
+ * config fallback). Carried on the variant so output formatting matches the
357
+ * gamut mapping applied during resolution.
358
+ */
359
+ pastel?: boolean;
338
360
  }
339
361
  /** Fully resolved color across all scheme variants. */
340
362
  interface ResolvedColor {
@@ -367,12 +389,6 @@ interface GlazeConfig {
367
389
  darkTone?: ToneWindow;
368
390
  /** Saturation reduction factor for dark scheme (0–1). Default: 0.1. */
369
391
  darkDesaturation?: number;
370
- /**
371
- * Saturation taper toward the tone extremes (0–1). The fraction of the
372
- * tone range over which saturation rolls off at each end, where in-gamut
373
- * chroma collapses. Default: 0.15. Set to 0 to disable.
374
- */
375
- saturationTaper?: number;
376
392
  /** State alias names for token export. */
377
393
  states?: {
378
394
  dark?: string;
@@ -397,12 +413,18 @@ interface GlazeConfig {
397
413
  * falls back to the originally requested tone).
398
414
  */
399
415
  autoFlip?: boolean;
416
+ /**
417
+ * If true, uses a hue-independent "safe" chroma limit across all colors
418
+ * so that scaling saturation never exceeds the sRGB boundary at any hue
419
+ * for the given lightness.
420
+ * @default false
421
+ */
422
+ pastel?: boolean;
400
423
  }
401
424
  interface GlazeConfigResolved {
402
425
  lightTone: ToneWindow;
403
426
  darkTone: ToneWindow;
404
427
  darkDesaturation: number;
405
- saturationTaper: number;
406
428
  states: {
407
429
  dark: string;
408
430
  highContrast: string;
@@ -410,6 +432,7 @@ interface GlazeConfigResolved {
410
432
  modes: Required<GlazeOutputModes>;
411
433
  shadowTuning?: ShadowTuning;
412
434
  autoFlip: boolean;
435
+ pastel: boolean;
413
436
  }
414
437
  /**
415
438
  * Per-instance config override for `glaze.color()` and `glaze()` themes.
@@ -425,10 +448,14 @@ interface GlazeConfigOverride {
425
448
  darkTone?: ToneWindow;
426
449
  /** Saturation reduction factor for dark scheme (0–1). */
427
450
  darkDesaturation?: number;
428
- /** Saturation taper toward the tone extremes (0–1). */
429
- saturationTaper?: number;
430
451
  /** Whether to auto-flip tone when contrast can't be met. */
431
452
  autoFlip?: boolean;
453
+ /**
454
+ * If true, uses a hue-independent "safe" chroma limit across all colors
455
+ * so that scaling saturation never exceeds the sRGB boundary at any hue
456
+ * for the given lightness.
457
+ */
458
+ pastel?: boolean;
432
459
  /**
433
460
  * Shadow tuning defaults. Only meaningful for themes; harmless on
434
461
  * standalone color tokens.
@@ -493,6 +520,13 @@ interface GlazeColorInput {
493
520
  * used). Does not affect output keys.
494
521
  */
495
522
  name?: string;
523
+ /**
524
+ * Per-color override for the hue-independent "safe" chroma limit used in
525
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
526
+ * Falls through to the global / per-theme `pastel` config when omitted.
527
+ * @see GlazeConfig.pastel
528
+ */
529
+ pastel?: boolean;
496
530
  }
497
531
  /**
498
532
  * Any single-color input form accepted by the value-shorthand
@@ -593,6 +627,13 @@ interface GlazeColorOverrides {
593
627
  * used). Does not affect output keys.
594
628
  */
595
629
  name?: string;
630
+ /**
631
+ * Per-color override for the hue-independent "safe" chroma limit used in
632
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
633
+ * Falls through to the global / per-theme `pastel` config when omitted.
634
+ * @see GlazeConfig.pastel
635
+ */
636
+ pastel?: boolean;
596
637
  }
597
638
  /**
598
639
  * Object input for `glaze.color()` that carries a raw color value plus
@@ -689,6 +730,7 @@ interface GlazeColorInputExport {
689
730
  base?: GlazeColorTokenExport | GlazeColorValue;
690
731
  contrast?: HCPair<ContrastSpec>;
691
732
  name?: string;
733
+ pastel?: boolean;
692
734
  }
693
735
  /**
694
736
  * Serializable shape of `GlazeColorOverrides`. `base` is replaced by
@@ -705,12 +747,15 @@ interface GlazeColorOverridesExport {
705
747
  base?: GlazeColorTokenExport | GlazeColorValue;
706
748
  opacity?: number;
707
749
  name?: string;
750
+ pastel?: boolean;
708
751
  }
709
752
  interface GlazeTheme {
710
753
  /** The hue seed (0–360). */
711
754
  readonly hue: number;
712
755
  /** The saturation seed (0–100). */
713
756
  readonly saturation: number;
757
+ /** The effective config for this theme. */
758
+ getConfig(): GlazeConfigResolved;
714
759
  /** Add/replace colors (additive merge with existing definitions). */
715
760
  colors(defs: ColorMap): void;
716
761
  /** Get a color definition by name. */
@@ -857,7 +902,7 @@ type PaletteInput = Record<string, GlazeTheme>;
857
902
  * Create a single-hue glaze theme.
858
903
  *
859
904
  * An optional `config` override can be supplied to customize the resolve
860
- * behavior for this theme (tone windows, saturation taper, etc.). The
905
+ * behavior for this theme (tone windows, etc.). The
861
906
  * override is **merged over the live global config at resolve time** —
862
907
  * the theme still reacts to later `configure()` calls for fields it
863
908
  * didn't override.
@@ -881,7 +926,7 @@ declare namespace glaze {
881
926
  var from: (data: GlazeThemeExport) => GlazeTheme;
882
927
  var color: (input: GlazeFromInput | GlazeColorInput | GlazeColorValue, config?: GlazeConfigOverride) => GlazeColorToken;
883
928
  var shadow: (input: GlazeShadowInput) => ResolvedColorVariant;
884
- var format: (variant: ResolvedColorVariant, colorFormat?: GlazeColorFormat) => string;
929
+ var format: (variant: ResolvedColorVariant, colorFormat?: GlazeColorFormat, pastel?: boolean) => string;
885
930
  var fromHex: (hex: string) => GlazeTheme;
886
931
  var fromRgb: (r: number, g: number, b: number) => GlazeTheme;
887
932
  var colorFrom: (data: GlazeColorTokenExport) => GlazeColorToken;
@@ -956,15 +1001,25 @@ type Vec3 = [number, number, number];
956
1001
  * OKHSL toe function: maps OKLab lightness L to perceptual lightness l.
957
1002
  * Exported for the OKHST tone transfers in `okhst.ts`.
958
1003
  */
1004
+ /**
1005
+ * OKHSL lightness of the gamut cusp for a hue — the lightness where the
1006
+ * realizable chroma peaks. Reuses the same `find_cusp` OKHSL already runs for
1007
+ * its `s` normalization (no new color math); the OKLab cusp lightness is run
1008
+ * through the OKHSL `toe` and clamped to `[0.001, 0.999]` so divisions that
1009
+ * key off it stay safe. Cached per (rounded) hue.
1010
+ *
1011
+ * @param h Hue, 0–360.
1012
+ */
1013
+ declare function cuspLightness(h: number): number;
959
1014
  /**
960
1015
  * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLab [L, a, b].
961
1016
  */
962
- declare function okhslToOklab(h: number, s: number, l: number): [number, number, number];
1017
+ declare function okhslToOklab(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
963
1018
  /**
964
1019
  * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to linear sRGB.
965
1020
  * Channels may exceed [0, 1] near gamut boundaries — caller must clamp if needed.
966
1021
  */
967
- declare function okhslToLinearSrgb(h: number, s: number, l: number): [number, number, number];
1022
+ declare function okhslToLinearSrgb(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
968
1023
  /**
969
1024
  * Compute relative luminance Y from linear sRGB channels.
970
1025
  * Per WCAG 2: Y = 0.2126·R + 0.7152·G + 0.0722·B
@@ -977,7 +1032,7 @@ declare function contrastRatioFromLuminance(yA: number, yB: number): number;
977
1032
  /**
978
1033
  * Convert OKHSL to gamma-encoded sRGB (clamped to 0–1).
979
1034
  */
980
- declare function okhslToSrgb(h: number, s: number, l: number): [number, number, number];
1035
+ declare function okhslToSrgb(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
981
1036
  /**
982
1037
  * Compute WCAG 2 relative luminance from linear sRGB, matching the browser
983
1038
  * rendering pipeline: gamma-encode, clamp to sRGB gamut [0,1], then linearize.
@@ -989,12 +1044,12 @@ declare function gamutClampedLuminance(linearRgb: [number, number, number]): num
989
1044
  * Input: [L, a, b] where L: 0–1, a/b: roughly -0.5 to 0.5.
990
1045
  * Returns [h, s, l] where h: 0–360, s: 0–1, l: 0–1.
991
1046
  */
992
- declare const oklabToOkhsl: (lab: Vec3) => Vec3;
1047
+ declare const oklabToOkhsl: (lab: Vec3, pastel?: boolean) => Vec3;
993
1048
  /**
994
1049
  * Convert gamma-encoded sRGB (0–1 per channel) to OKHSL.
995
1050
  * Returns [h, s, l] where h: 0–360, s: 0–1, l: 0–1.
996
1051
  */
997
- declare function srgbToOkhsl(rgb: [number, number, number]): [number, number, number];
1052
+ declare function srgbToOkhsl(rgb: [number, number, number], pastel?: boolean): [number, number, number];
998
1053
  /**
999
1054
  * Convert CSS HSL (sRGB-based) to gamma-encoded sRGB [r, g, b] in 0–1 range.
1000
1055
  * h: 0–360, s: 0–1, l: 0–1.
@@ -1024,23 +1079,23 @@ declare function parseHexAlpha(hex: string): {
1024
1079
  * Format OKHSL values as a CSS `okhsl(H S% L%)` string.
1025
1080
  * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
1026
1081
  */
1027
- declare function formatOkhsl(h: number, s: number, l: number): string;
1082
+ declare function formatOkhsl(h: number, s: number, l: number, pastel?: boolean): string;
1028
1083
  /**
1029
1084
  * Format OKHSL values as a CSS `rgb(R G B)` string.
1030
1085
  * Uses 2 decimal places to avoid 8-bit quantization contrast loss.
1031
1086
  * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
1032
1087
  */
1033
- declare function formatRgb(h: number, s: number, l: number): string;
1088
+ declare function formatRgb(h: number, s: number, l: number, pastel?: boolean): string;
1034
1089
  /**
1035
1090
  * Format OKHSL values as a CSS `hsl(H S% L%)` string.
1036
1091
  * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
1037
1092
  */
1038
- declare function formatHsl(h: number, s: number, l: number): string;
1093
+ declare function formatHsl(h: number, s: number, l: number, pastel?: boolean): string;
1039
1094
  /**
1040
1095
  * Format OKHSL values as a CSS `oklch(L C H)` string.
1041
1096
  * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
1042
1097
  */
1043
- declare function formatOklch(h: number, s: number, l: number): string;
1098
+ declare function formatOklch(h: number, s: number, l: number, pastel?: boolean): string;
1044
1099
  //#endregion
1045
- export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type ContrastSpec, type ExtremeValue, type FindToneForContrastOptions, type FindToneForContrastResult, type FindValueForMixContrastOptions, type FindValueForMixContrastResult, type GlazeColorCssOptions, type GlazeColorFormat, type GlazeColorInput, type GlazeColorInputExport, type GlazeColorOverrides, type GlazeColorOverridesExport, type GlazeColorToken, type GlazeColorTokenExport, type GlazeColorValue, type GlazeConfig, type GlazeConfigOverride, type GlazeConfigResolved, type GlazeCssOptions, type GlazeCssResult, type GlazeExtendOptions, type GlazeFromInput, type GlazeJsonOptions, type GlazeOutputModes, type GlazePalette, type GlazePaletteExportOptions, type GlazePaletteOptions, type GlazeShadowInput, type GlazeTheme, type GlazeThemeExport, type GlazeTokenOptions, type HCPair, type HexColor, type MinContrast, type MixColorDef, type OkhslColor, type OkhstColor, type OklchColor, REF_EPS, type RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type ResolvedContrast, type RgbColor, type ShadowColorDef, type ShadowTuning, type ToneValue, type ToneWindow, apcaContrast, contrastRatioFromLuminance, findToneForContrast, findValueForMixContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, fromTone, gamutClampedLuminance, glaze, hslToSrgb, okhslToLinearSrgb, okhslToOkhst, okhslToOklab, okhslToSrgb, okhstToOkhsl, oklabToOkhsl, parseHex, parseHexAlpha, relativeLuminanceFromLinearRgb, resolveContrastForMode, resolveMinContrast, srgbToOkhsl, toTone, toneFromY, variantToOkhsl, yFromTone };
1100
+ export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type ContrastSpec, type ExtremeValue, type FindToneForContrastOptions, type FindToneForContrastResult, type FindValueForMixContrastOptions, type FindValueForMixContrastResult, type GlazeColorCssOptions, type GlazeColorFormat, type GlazeColorInput, type GlazeColorInputExport, type GlazeColorOverrides, type GlazeColorOverridesExport, type GlazeColorToken, type GlazeColorTokenExport, type GlazeColorValue, type GlazeConfig, type GlazeConfigOverride, type GlazeConfigResolved, type GlazeCssOptions, type GlazeCssResult, type GlazeExtendOptions, type GlazeFromInput, type GlazeJsonOptions, type GlazeOutputModes, type GlazePalette, type GlazePaletteExportOptions, type GlazePaletteOptions, type GlazeShadowInput, type GlazeTheme, type GlazeThemeExport, type GlazeTokenOptions, type HCPair, type HexColor, type MinContrast, type MixColorDef, type OkhslColor, type OkhstColor, type OklchColor, REF_EPS, type RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type ResolvedContrast, type RgbColor, type ShadowColorDef, type ShadowTuning, type ToneValue, type ToneWindow, apcaContrast, contrastRatioFromLuminance, cuspLightness, findToneForContrast, findValueForMixContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, fromTone, gamutClampedLuminance, glaze, hslToSrgb, okhslToLinearSrgb, okhslToOkhst, okhslToOklab, okhslToSrgb, okhstToOkhsl, oklabToOkhsl, parseHex, parseHexAlpha, relativeLuminanceFromLinearRgb, resolveContrastForMode, resolveMinContrast, srgbToOkhsl, toTone, toneFromY, variantToOkhsl, yFromTone };
1046
1101
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -41,13 +41,8 @@ interface FindToneForContrastOptions {
41
41
  initialDirection?: 'lighter' | 'darker';
42
42
  /** Auto-flip tone direction when contrast can't be met. Default: false. */
43
43
  flip?: boolean;
44
- /**
45
- * Saturation taper strength (0–1). When set, candidate saturation is rolled
46
- * off toward the tone extremes via the same envelope the renderer applies,
47
- * so the solved tone meets the floor with its *rendered* saturation. Default
48
- * `0` (no taper) for direct/advanced callers.
49
- */
50
- saturationTaper?: number;
44
+ /** Use the hue-independent "safe" chroma boundary. Default: false. */
45
+ pastel?: boolean;
51
46
  }
52
47
  interface FindToneForContrastResult {
53
48
  /** Chosen tone in 0–1. */
@@ -222,6 +217,13 @@ interface RegularColorDef {
222
217
  * should not be combined (a console.warn is emitted).
223
218
  */
224
219
  opacity?: number;
220
+ /**
221
+ * Per-color override for the hue-independent "safe" chroma limit used in
222
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
223
+ * Falls through to the global / per-theme `pastel` config when omitted.
224
+ * @see GlazeConfig.pastel
225
+ */
226
+ pastel?: boolean;
225
227
  /**
226
228
  * Whether this color is inherited by child themes created via `extend()`.
227
229
  * Default: true. Set to false to make this color local to the current theme.
@@ -271,6 +273,13 @@ interface ShadowColorDef {
271
273
  intensity: HCPair<number>;
272
274
  /** Override default tuning. Merged field-by-field with global `shadowTuning`. */
273
275
  tuning?: ShadowTuning;
276
+ /**
277
+ * Per-color override for the hue-independent "safe" chroma limit used in
278
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
279
+ * Falls through to the global / per-theme `pastel` config when omitted.
280
+ * @see GlazeConfig.pastel
281
+ */
282
+ pastel?: boolean;
274
283
  /**
275
284
  * Whether this color is inherited by child themes created via `extend()`.
276
285
  * Default: true. Set to false to make this color local to the current theme.
@@ -311,6 +320,13 @@ interface MixColorDef {
311
320
  * metric. Supports [normal, highContrast] pair.
312
321
  */
313
322
  contrast?: HCPair<ContrastSpec>;
323
+ /**
324
+ * Per-color override for the hue-independent "safe" chroma limit used in
325
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
326
+ * Falls through to the global / per-theme `pastel` config when omitted.
327
+ * @see GlazeConfig.pastel
328
+ */
329
+ pastel?: boolean;
314
330
  /**
315
331
  * Whether this color is inherited by child themes created via `extend()`.
316
332
  * Default: true. Set to false to make this color local to the current theme.
@@ -335,6 +351,12 @@ interface ResolvedColorVariant {
335
351
  t: number;
336
352
  /** Opacity (0–1). Default: 1. */
337
353
  alpha: number;
354
+ /**
355
+ * Effective `pastel` flag used while resolving this variant (author def or
356
+ * config fallback). Carried on the variant so output formatting matches the
357
+ * gamut mapping applied during resolution.
358
+ */
359
+ pastel?: boolean;
338
360
  }
339
361
  /** Fully resolved color across all scheme variants. */
340
362
  interface ResolvedColor {
@@ -367,12 +389,6 @@ interface GlazeConfig {
367
389
  darkTone?: ToneWindow;
368
390
  /** Saturation reduction factor for dark scheme (0–1). Default: 0.1. */
369
391
  darkDesaturation?: number;
370
- /**
371
- * Saturation taper toward the tone extremes (0–1). The fraction of the
372
- * tone range over which saturation rolls off at each end, where in-gamut
373
- * chroma collapses. Default: 0.15. Set to 0 to disable.
374
- */
375
- saturationTaper?: number;
376
392
  /** State alias names for token export. */
377
393
  states?: {
378
394
  dark?: string;
@@ -397,12 +413,18 @@ interface GlazeConfig {
397
413
  * falls back to the originally requested tone).
398
414
  */
399
415
  autoFlip?: boolean;
416
+ /**
417
+ * If true, uses a hue-independent "safe" chroma limit across all colors
418
+ * so that scaling saturation never exceeds the sRGB boundary at any hue
419
+ * for the given lightness.
420
+ * @default false
421
+ */
422
+ pastel?: boolean;
400
423
  }
401
424
  interface GlazeConfigResolved {
402
425
  lightTone: ToneWindow;
403
426
  darkTone: ToneWindow;
404
427
  darkDesaturation: number;
405
- saturationTaper: number;
406
428
  states: {
407
429
  dark: string;
408
430
  highContrast: string;
@@ -410,6 +432,7 @@ interface GlazeConfigResolved {
410
432
  modes: Required<GlazeOutputModes>;
411
433
  shadowTuning?: ShadowTuning;
412
434
  autoFlip: boolean;
435
+ pastel: boolean;
413
436
  }
414
437
  /**
415
438
  * Per-instance config override for `glaze.color()` and `glaze()` themes.
@@ -425,10 +448,14 @@ interface GlazeConfigOverride {
425
448
  darkTone?: ToneWindow;
426
449
  /** Saturation reduction factor for dark scheme (0–1). */
427
450
  darkDesaturation?: number;
428
- /** Saturation taper toward the tone extremes (0–1). */
429
- saturationTaper?: number;
430
451
  /** Whether to auto-flip tone when contrast can't be met. */
431
452
  autoFlip?: boolean;
453
+ /**
454
+ * If true, uses a hue-independent "safe" chroma limit across all colors
455
+ * so that scaling saturation never exceeds the sRGB boundary at any hue
456
+ * for the given lightness.
457
+ */
458
+ pastel?: boolean;
432
459
  /**
433
460
  * Shadow tuning defaults. Only meaningful for themes; harmless on
434
461
  * standalone color tokens.
@@ -493,6 +520,13 @@ interface GlazeColorInput {
493
520
  * used). Does not affect output keys.
494
521
  */
495
522
  name?: string;
523
+ /**
524
+ * Per-color override for the hue-independent "safe" chroma limit used in
525
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
526
+ * Falls through to the global / per-theme `pastel` config when omitted.
527
+ * @see GlazeConfig.pastel
528
+ */
529
+ pastel?: boolean;
496
530
  }
497
531
  /**
498
532
  * Any single-color input form accepted by the value-shorthand
@@ -593,6 +627,13 @@ interface GlazeColorOverrides {
593
627
  * used). Does not affect output keys.
594
628
  */
595
629
  name?: string;
630
+ /**
631
+ * Per-color override for the hue-independent "safe" chroma limit used in
632
+ * OKHSL↔sRGB conversions (luminance, contrast solving, output formatting).
633
+ * Falls through to the global / per-theme `pastel` config when omitted.
634
+ * @see GlazeConfig.pastel
635
+ */
636
+ pastel?: boolean;
596
637
  }
597
638
  /**
598
639
  * Object input for `glaze.color()` that carries a raw color value plus
@@ -689,6 +730,7 @@ interface GlazeColorInputExport {
689
730
  base?: GlazeColorTokenExport | GlazeColorValue;
690
731
  contrast?: HCPair<ContrastSpec>;
691
732
  name?: string;
733
+ pastel?: boolean;
692
734
  }
693
735
  /**
694
736
  * Serializable shape of `GlazeColorOverrides`. `base` is replaced by
@@ -705,12 +747,15 @@ interface GlazeColorOverridesExport {
705
747
  base?: GlazeColorTokenExport | GlazeColorValue;
706
748
  opacity?: number;
707
749
  name?: string;
750
+ pastel?: boolean;
708
751
  }
709
752
  interface GlazeTheme {
710
753
  /** The hue seed (0–360). */
711
754
  readonly hue: number;
712
755
  /** The saturation seed (0–100). */
713
756
  readonly saturation: number;
757
+ /** The effective config for this theme. */
758
+ getConfig(): GlazeConfigResolved;
714
759
  /** Add/replace colors (additive merge with existing definitions). */
715
760
  colors(defs: ColorMap): void;
716
761
  /** Get a color definition by name. */
@@ -857,7 +902,7 @@ type PaletteInput = Record<string, GlazeTheme>;
857
902
  * Create a single-hue glaze theme.
858
903
  *
859
904
  * An optional `config` override can be supplied to customize the resolve
860
- * behavior for this theme (tone windows, saturation taper, etc.). The
905
+ * behavior for this theme (tone windows, etc.). The
861
906
  * override is **merged over the live global config at resolve time** —
862
907
  * the theme still reacts to later `configure()` calls for fields it
863
908
  * didn't override.
@@ -881,7 +926,7 @@ declare namespace glaze {
881
926
  var from: (data: GlazeThemeExport) => GlazeTheme;
882
927
  var color: (input: GlazeFromInput | GlazeColorInput | GlazeColorValue, config?: GlazeConfigOverride) => GlazeColorToken;
883
928
  var shadow: (input: GlazeShadowInput) => ResolvedColorVariant;
884
- var format: (variant: ResolvedColorVariant, colorFormat?: GlazeColorFormat) => string;
929
+ var format: (variant: ResolvedColorVariant, colorFormat?: GlazeColorFormat, pastel?: boolean) => string;
885
930
  var fromHex: (hex: string) => GlazeTheme;
886
931
  var fromRgb: (r: number, g: number, b: number) => GlazeTheme;
887
932
  var colorFrom: (data: GlazeColorTokenExport) => GlazeColorToken;
@@ -956,15 +1001,25 @@ type Vec3 = [number, number, number];
956
1001
  * OKHSL toe function: maps OKLab lightness L to perceptual lightness l.
957
1002
  * Exported for the OKHST tone transfers in `okhst.ts`.
958
1003
  */
1004
+ /**
1005
+ * OKHSL lightness of the gamut cusp for a hue — the lightness where the
1006
+ * realizable chroma peaks. Reuses the same `find_cusp` OKHSL already runs for
1007
+ * its `s` normalization (no new color math); the OKLab cusp lightness is run
1008
+ * through the OKHSL `toe` and clamped to `[0.001, 0.999]` so divisions that
1009
+ * key off it stay safe. Cached per (rounded) hue.
1010
+ *
1011
+ * @param h Hue, 0–360.
1012
+ */
1013
+ declare function cuspLightness(h: number): number;
959
1014
  /**
960
1015
  * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLab [L, a, b].
961
1016
  */
962
- declare function okhslToOklab(h: number, s: number, l: number): [number, number, number];
1017
+ declare function okhslToOklab(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
963
1018
  /**
964
1019
  * Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to linear sRGB.
965
1020
  * Channels may exceed [0, 1] near gamut boundaries — caller must clamp if needed.
966
1021
  */
967
- declare function okhslToLinearSrgb(h: number, s: number, l: number): [number, number, number];
1022
+ declare function okhslToLinearSrgb(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
968
1023
  /**
969
1024
  * Compute relative luminance Y from linear sRGB channels.
970
1025
  * Per WCAG 2: Y = 0.2126·R + 0.7152·G + 0.0722·B
@@ -977,7 +1032,7 @@ declare function contrastRatioFromLuminance(yA: number, yB: number): number;
977
1032
  /**
978
1033
  * Convert OKHSL to gamma-encoded sRGB (clamped to 0–1).
979
1034
  */
980
- declare function okhslToSrgb(h: number, s: number, l: number): [number, number, number];
1035
+ declare function okhslToSrgb(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
981
1036
  /**
982
1037
  * Compute WCAG 2 relative luminance from linear sRGB, matching the browser
983
1038
  * rendering pipeline: gamma-encode, clamp to sRGB gamut [0,1], then linearize.
@@ -989,12 +1044,12 @@ declare function gamutClampedLuminance(linearRgb: [number, number, number]): num
989
1044
  * Input: [L, a, b] where L: 0–1, a/b: roughly -0.5 to 0.5.
990
1045
  * Returns [h, s, l] where h: 0–360, s: 0–1, l: 0–1.
991
1046
  */
992
- declare const oklabToOkhsl: (lab: Vec3) => Vec3;
1047
+ declare const oklabToOkhsl: (lab: Vec3, pastel?: boolean) => Vec3;
993
1048
  /**
994
1049
  * Convert gamma-encoded sRGB (0–1 per channel) to OKHSL.
995
1050
  * Returns [h, s, l] where h: 0–360, s: 0–1, l: 0–1.
996
1051
  */
997
- declare function srgbToOkhsl(rgb: [number, number, number]): [number, number, number];
1052
+ declare function srgbToOkhsl(rgb: [number, number, number], pastel?: boolean): [number, number, number];
998
1053
  /**
999
1054
  * Convert CSS HSL (sRGB-based) to gamma-encoded sRGB [r, g, b] in 0–1 range.
1000
1055
  * h: 0–360, s: 0–1, l: 0–1.
@@ -1024,23 +1079,23 @@ declare function parseHexAlpha(hex: string): {
1024
1079
  * Format OKHSL values as a CSS `okhsl(H S% L%)` string.
1025
1080
  * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
1026
1081
  */
1027
- declare function formatOkhsl(h: number, s: number, l: number): string;
1082
+ declare function formatOkhsl(h: number, s: number, l: number, pastel?: boolean): string;
1028
1083
  /**
1029
1084
  * Format OKHSL values as a CSS `rgb(R G B)` string.
1030
1085
  * Uses 2 decimal places to avoid 8-bit quantization contrast loss.
1031
1086
  * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
1032
1087
  */
1033
- declare function formatRgb(h: number, s: number, l: number): string;
1088
+ declare function formatRgb(h: number, s: number, l: number, pastel?: boolean): string;
1034
1089
  /**
1035
1090
  * Format OKHSL values as a CSS `hsl(H S% L%)` string.
1036
1091
  * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
1037
1092
  */
1038
- declare function formatHsl(h: number, s: number, l: number): string;
1093
+ declare function formatHsl(h: number, s: number, l: number, pastel?: boolean): string;
1039
1094
  /**
1040
1095
  * Format OKHSL values as a CSS `oklch(L C H)` string.
1041
1096
  * h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
1042
1097
  */
1043
- declare function formatOklch(h: number, s: number, l: number): string;
1098
+ declare function formatOklch(h: number, s: number, l: number, pastel?: boolean): string;
1044
1099
  //#endregion
1045
- export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type ContrastSpec, type ExtremeValue, type FindToneForContrastOptions, type FindToneForContrastResult, type FindValueForMixContrastOptions, type FindValueForMixContrastResult, type GlazeColorCssOptions, type GlazeColorFormat, type GlazeColorInput, type GlazeColorInputExport, type GlazeColorOverrides, type GlazeColorOverridesExport, type GlazeColorToken, type GlazeColorTokenExport, type GlazeColorValue, type GlazeConfig, type GlazeConfigOverride, type GlazeConfigResolved, type GlazeCssOptions, type GlazeCssResult, type GlazeExtendOptions, type GlazeFromInput, type GlazeJsonOptions, type GlazeOutputModes, type GlazePalette, type GlazePaletteExportOptions, type GlazePaletteOptions, type GlazeShadowInput, type GlazeTheme, type GlazeThemeExport, type GlazeTokenOptions, type HCPair, type HexColor, type MinContrast, type MixColorDef, type OkhslColor, type OkhstColor, type OklchColor, REF_EPS, type RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type ResolvedContrast, type RgbColor, type ShadowColorDef, type ShadowTuning, type ToneValue, type ToneWindow, apcaContrast, contrastRatioFromLuminance, findToneForContrast, findValueForMixContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, fromTone, gamutClampedLuminance, glaze, hslToSrgb, okhslToLinearSrgb, okhslToOkhst, okhslToOklab, okhslToSrgb, okhstToOkhsl, oklabToOkhsl, parseHex, parseHexAlpha, relativeLuminanceFromLinearRgb, resolveContrastForMode, resolveMinContrast, srgbToOkhsl, toTone, toneFromY, variantToOkhsl, yFromTone };
1100
+ export { type AdaptationMode, type ColorDef, type ColorMap, type ContrastPreset, type ContrastSpec, type ExtremeValue, type FindToneForContrastOptions, type FindToneForContrastResult, type FindValueForMixContrastOptions, type FindValueForMixContrastResult, type GlazeColorCssOptions, type GlazeColorFormat, type GlazeColorInput, type GlazeColorInputExport, type GlazeColorOverrides, type GlazeColorOverridesExport, type GlazeColorToken, type GlazeColorTokenExport, type GlazeColorValue, type GlazeConfig, type GlazeConfigOverride, type GlazeConfigResolved, type GlazeCssOptions, type GlazeCssResult, type GlazeExtendOptions, type GlazeFromInput, type GlazeJsonOptions, type GlazeOutputModes, type GlazePalette, type GlazePaletteExportOptions, type GlazePaletteOptions, type GlazeShadowInput, type GlazeTheme, type GlazeThemeExport, type GlazeTokenOptions, type HCPair, type HexColor, type MinContrast, type MixColorDef, type OkhslColor, type OkhstColor, type OklchColor, REF_EPS, type RegularColorDef, type RelativeValue, type ResolvedColor, type ResolvedColorVariant, type ResolvedContrast, type RgbColor, type ShadowColorDef, type ShadowTuning, type ToneValue, type ToneWindow, apcaContrast, contrastRatioFromLuminance, cuspLightness, findToneForContrast, findValueForMixContrast, formatHsl, formatOkhsl, formatOklch, formatRgb, fromTone, gamutClampedLuminance, glaze, hslToSrgb, okhslToLinearSrgb, okhslToOkhst, okhslToOklab, okhslToSrgb, okhstToOkhsl, oklabToOkhsl, parseHex, parseHexAlpha, relativeLuminanceFromLinearRgb, resolveContrastForMode, resolveMinContrast, srgbToOkhsl, toTone, toneFromY, variantToOkhsl, yFromTone };
1046
1101
  //# sourceMappingURL=index.d.mts.map