@tenphi/glaze 0.14.0 → 0.15.0
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/README.md +1 -1
- package/dist/index.cjs +161 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -28
- package/dist/index.d.mts +40 -28
- package/dist/index.mjs +161 -141
- package/dist/index.mjs.map +1 -1
- package/docs/api.md +1 -9
- package/docs/migration.md +1 -1
- package/docs/okhst.md +1 -9
- package/package.json +5 -2
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
|
-
|
|
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. */
|
|
@@ -367,12 +362,6 @@ interface GlazeConfig {
|
|
|
367
362
|
darkTone?: ToneWindow;
|
|
368
363
|
/** Saturation reduction factor for dark scheme (0–1). Default: 0.1. */
|
|
369
364
|
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
365
|
/** State alias names for token export. */
|
|
377
366
|
states?: {
|
|
378
367
|
dark?: string;
|
|
@@ -397,12 +386,18 @@ interface GlazeConfig {
|
|
|
397
386
|
* falls back to the originally requested tone).
|
|
398
387
|
*/
|
|
399
388
|
autoFlip?: boolean;
|
|
389
|
+
/**
|
|
390
|
+
* If true, uses a hue-independent "safe" chroma limit across all colors
|
|
391
|
+
* so that scaling saturation never exceeds the sRGB boundary at any hue
|
|
392
|
+
* for the given lightness.
|
|
393
|
+
* @default false
|
|
394
|
+
*/
|
|
395
|
+
pastel?: boolean;
|
|
400
396
|
}
|
|
401
397
|
interface GlazeConfigResolved {
|
|
402
398
|
lightTone: ToneWindow;
|
|
403
399
|
darkTone: ToneWindow;
|
|
404
400
|
darkDesaturation: number;
|
|
405
|
-
saturationTaper: number;
|
|
406
401
|
states: {
|
|
407
402
|
dark: string;
|
|
408
403
|
highContrast: string;
|
|
@@ -410,6 +405,7 @@ interface GlazeConfigResolved {
|
|
|
410
405
|
modes: Required<GlazeOutputModes>;
|
|
411
406
|
shadowTuning?: ShadowTuning;
|
|
412
407
|
autoFlip: boolean;
|
|
408
|
+
pastel: boolean;
|
|
413
409
|
}
|
|
414
410
|
/**
|
|
415
411
|
* Per-instance config override for `glaze.color()` and `glaze()` themes.
|
|
@@ -425,10 +421,14 @@ interface GlazeConfigOverride {
|
|
|
425
421
|
darkTone?: ToneWindow;
|
|
426
422
|
/** Saturation reduction factor for dark scheme (0–1). */
|
|
427
423
|
darkDesaturation?: number;
|
|
428
|
-
/** Saturation taper toward the tone extremes (0–1). */
|
|
429
|
-
saturationTaper?: number;
|
|
430
424
|
/** Whether to auto-flip tone when contrast can't be met. */
|
|
431
425
|
autoFlip?: boolean;
|
|
426
|
+
/**
|
|
427
|
+
* If true, uses a hue-independent "safe" chroma limit across all colors
|
|
428
|
+
* so that scaling saturation never exceeds the sRGB boundary at any hue
|
|
429
|
+
* for the given lightness.
|
|
430
|
+
*/
|
|
431
|
+
pastel?: boolean;
|
|
432
432
|
/**
|
|
433
433
|
* Shadow tuning defaults. Only meaningful for themes; harmless on
|
|
434
434
|
* standalone color tokens.
|
|
@@ -711,6 +711,8 @@ interface GlazeTheme {
|
|
|
711
711
|
readonly hue: number;
|
|
712
712
|
/** The saturation seed (0–100). */
|
|
713
713
|
readonly saturation: number;
|
|
714
|
+
/** The effective config for this theme. */
|
|
715
|
+
getConfig(): GlazeConfigResolved;
|
|
714
716
|
/** Add/replace colors (additive merge with existing definitions). */
|
|
715
717
|
colors(defs: ColorMap): void;
|
|
716
718
|
/** Get a color definition by name. */
|
|
@@ -857,7 +859,7 @@ type PaletteInput = Record<string, GlazeTheme>;
|
|
|
857
859
|
* Create a single-hue glaze theme.
|
|
858
860
|
*
|
|
859
861
|
* An optional `config` override can be supplied to customize the resolve
|
|
860
|
-
* behavior for this theme (tone windows,
|
|
862
|
+
* behavior for this theme (tone windows, etc.). The
|
|
861
863
|
* override is **merged over the live global config at resolve time** —
|
|
862
864
|
* the theme still reacts to later `configure()` calls for fields it
|
|
863
865
|
* didn't override.
|
|
@@ -881,7 +883,7 @@ declare namespace glaze {
|
|
|
881
883
|
var from: (data: GlazeThemeExport) => GlazeTheme;
|
|
882
884
|
var color: (input: GlazeFromInput | GlazeColorInput | GlazeColorValue, config?: GlazeConfigOverride) => GlazeColorToken;
|
|
883
885
|
var shadow: (input: GlazeShadowInput) => ResolvedColorVariant;
|
|
884
|
-
var format: (variant: ResolvedColorVariant, colorFormat?: GlazeColorFormat) => string;
|
|
886
|
+
var format: (variant: ResolvedColorVariant, colorFormat?: GlazeColorFormat, pastel?: boolean) => string;
|
|
885
887
|
var fromHex: (hex: string) => GlazeTheme;
|
|
886
888
|
var fromRgb: (r: number, g: number, b: number) => GlazeTheme;
|
|
887
889
|
var colorFrom: (data: GlazeColorTokenExport) => GlazeColorToken;
|
|
@@ -956,15 +958,25 @@ type Vec3 = [number, number, number];
|
|
|
956
958
|
* OKHSL toe function: maps OKLab lightness L to perceptual lightness l.
|
|
957
959
|
* Exported for the OKHST tone transfers in `okhst.ts`.
|
|
958
960
|
*/
|
|
961
|
+
/**
|
|
962
|
+
* OKHSL lightness of the gamut cusp for a hue — the lightness where the
|
|
963
|
+
* realizable chroma peaks. Reuses the same `find_cusp` OKHSL already runs for
|
|
964
|
+
* its `s` normalization (no new color math); the OKLab cusp lightness is run
|
|
965
|
+
* through the OKHSL `toe` and clamped to `[0.001, 0.999]` so divisions that
|
|
966
|
+
* key off it stay safe. Cached per (rounded) hue.
|
|
967
|
+
*
|
|
968
|
+
* @param h Hue, 0–360.
|
|
969
|
+
*/
|
|
970
|
+
declare function cuspLightness(h: number): number;
|
|
959
971
|
/**
|
|
960
972
|
* Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLab [L, a, b].
|
|
961
973
|
*/
|
|
962
|
-
declare function okhslToOklab(h: number, s: number, l: number): [number, number, number];
|
|
974
|
+
declare function okhslToOklab(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
|
|
963
975
|
/**
|
|
964
976
|
* Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to linear sRGB.
|
|
965
977
|
* Channels may exceed [0, 1] near gamut boundaries — caller must clamp if needed.
|
|
966
978
|
*/
|
|
967
|
-
declare function okhslToLinearSrgb(h: number, s: number, l: number): [number, number, number];
|
|
979
|
+
declare function okhslToLinearSrgb(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
|
|
968
980
|
/**
|
|
969
981
|
* Compute relative luminance Y from linear sRGB channels.
|
|
970
982
|
* Per WCAG 2: Y = 0.2126·R + 0.7152·G + 0.0722·B
|
|
@@ -977,7 +989,7 @@ declare function contrastRatioFromLuminance(yA: number, yB: number): number;
|
|
|
977
989
|
/**
|
|
978
990
|
* Convert OKHSL to gamma-encoded sRGB (clamped to 0–1).
|
|
979
991
|
*/
|
|
980
|
-
declare function okhslToSrgb(h: number, s: number, l: number): [number, number, number];
|
|
992
|
+
declare function okhslToSrgb(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
|
|
981
993
|
/**
|
|
982
994
|
* Compute WCAG 2 relative luminance from linear sRGB, matching the browser
|
|
983
995
|
* rendering pipeline: gamma-encode, clamp to sRGB gamut [0,1], then linearize.
|
|
@@ -989,12 +1001,12 @@ declare function gamutClampedLuminance(linearRgb: [number, number, number]): num
|
|
|
989
1001
|
* Input: [L, a, b] where L: 0–1, a/b: roughly -0.5 to 0.5.
|
|
990
1002
|
* Returns [h, s, l] where h: 0–360, s: 0–1, l: 0–1.
|
|
991
1003
|
*/
|
|
992
|
-
declare const oklabToOkhsl: (lab: Vec3) => Vec3;
|
|
1004
|
+
declare const oklabToOkhsl: (lab: Vec3, pastel?: boolean) => Vec3;
|
|
993
1005
|
/**
|
|
994
1006
|
* Convert gamma-encoded sRGB (0–1 per channel) to OKHSL.
|
|
995
1007
|
* Returns [h, s, l] where h: 0–360, s: 0–1, l: 0–1.
|
|
996
1008
|
*/
|
|
997
|
-
declare function srgbToOkhsl(rgb: [number, number, number]): [number, number, number];
|
|
1009
|
+
declare function srgbToOkhsl(rgb: [number, number, number], pastel?: boolean): [number, number, number];
|
|
998
1010
|
/**
|
|
999
1011
|
* Convert CSS HSL (sRGB-based) to gamma-encoded sRGB [r, g, b] in 0–1 range.
|
|
1000
1012
|
* h: 0–360, s: 0–1, l: 0–1.
|
|
@@ -1024,23 +1036,23 @@ declare function parseHexAlpha(hex: string): {
|
|
|
1024
1036
|
* Format OKHSL values as a CSS `okhsl(H S% L%)` string.
|
|
1025
1037
|
* h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
|
|
1026
1038
|
*/
|
|
1027
|
-
declare function formatOkhsl(h: number, s: number, l: number): string;
|
|
1039
|
+
declare function formatOkhsl(h: number, s: number, l: number, pastel?: boolean): string;
|
|
1028
1040
|
/**
|
|
1029
1041
|
* Format OKHSL values as a CSS `rgb(R G B)` string.
|
|
1030
1042
|
* Uses 2 decimal places to avoid 8-bit quantization contrast loss.
|
|
1031
1043
|
* h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
|
|
1032
1044
|
*/
|
|
1033
|
-
declare function formatRgb(h: number, s: number, l: number): string;
|
|
1045
|
+
declare function formatRgb(h: number, s: number, l: number, pastel?: boolean): string;
|
|
1034
1046
|
/**
|
|
1035
1047
|
* Format OKHSL values as a CSS `hsl(H S% L%)` string.
|
|
1036
1048
|
* h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
|
|
1037
1049
|
*/
|
|
1038
|
-
declare function formatHsl(h: number, s: number, l: number): string;
|
|
1050
|
+
declare function formatHsl(h: number, s: number, l: number, pastel?: boolean): string;
|
|
1039
1051
|
/**
|
|
1040
1052
|
* Format OKHSL values as a CSS `oklch(L C H)` string.
|
|
1041
1053
|
* h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
|
|
1042
1054
|
*/
|
|
1043
|
-
declare function formatOklch(h: number, s: number, l: number): string;
|
|
1055
|
+
declare function formatOklch(h: number, s: number, l: number, pastel?: boolean): string;
|
|
1044
1056
|
//#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 };
|
|
1057
|
+
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
1058
|
//# 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
|
-
|
|
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. */
|
|
@@ -367,12 +362,6 @@ interface GlazeConfig {
|
|
|
367
362
|
darkTone?: ToneWindow;
|
|
368
363
|
/** Saturation reduction factor for dark scheme (0–1). Default: 0.1. */
|
|
369
364
|
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
365
|
/** State alias names for token export. */
|
|
377
366
|
states?: {
|
|
378
367
|
dark?: string;
|
|
@@ -397,12 +386,18 @@ interface GlazeConfig {
|
|
|
397
386
|
* falls back to the originally requested tone).
|
|
398
387
|
*/
|
|
399
388
|
autoFlip?: boolean;
|
|
389
|
+
/**
|
|
390
|
+
* If true, uses a hue-independent "safe" chroma limit across all colors
|
|
391
|
+
* so that scaling saturation never exceeds the sRGB boundary at any hue
|
|
392
|
+
* for the given lightness.
|
|
393
|
+
* @default false
|
|
394
|
+
*/
|
|
395
|
+
pastel?: boolean;
|
|
400
396
|
}
|
|
401
397
|
interface GlazeConfigResolved {
|
|
402
398
|
lightTone: ToneWindow;
|
|
403
399
|
darkTone: ToneWindow;
|
|
404
400
|
darkDesaturation: number;
|
|
405
|
-
saturationTaper: number;
|
|
406
401
|
states: {
|
|
407
402
|
dark: string;
|
|
408
403
|
highContrast: string;
|
|
@@ -410,6 +405,7 @@ interface GlazeConfigResolved {
|
|
|
410
405
|
modes: Required<GlazeOutputModes>;
|
|
411
406
|
shadowTuning?: ShadowTuning;
|
|
412
407
|
autoFlip: boolean;
|
|
408
|
+
pastel: boolean;
|
|
413
409
|
}
|
|
414
410
|
/**
|
|
415
411
|
* Per-instance config override for `glaze.color()` and `glaze()` themes.
|
|
@@ -425,10 +421,14 @@ interface GlazeConfigOverride {
|
|
|
425
421
|
darkTone?: ToneWindow;
|
|
426
422
|
/** Saturation reduction factor for dark scheme (0–1). */
|
|
427
423
|
darkDesaturation?: number;
|
|
428
|
-
/** Saturation taper toward the tone extremes (0–1). */
|
|
429
|
-
saturationTaper?: number;
|
|
430
424
|
/** Whether to auto-flip tone when contrast can't be met. */
|
|
431
425
|
autoFlip?: boolean;
|
|
426
|
+
/**
|
|
427
|
+
* If true, uses a hue-independent "safe" chroma limit across all colors
|
|
428
|
+
* so that scaling saturation never exceeds the sRGB boundary at any hue
|
|
429
|
+
* for the given lightness.
|
|
430
|
+
*/
|
|
431
|
+
pastel?: boolean;
|
|
432
432
|
/**
|
|
433
433
|
* Shadow tuning defaults. Only meaningful for themes; harmless on
|
|
434
434
|
* standalone color tokens.
|
|
@@ -711,6 +711,8 @@ interface GlazeTheme {
|
|
|
711
711
|
readonly hue: number;
|
|
712
712
|
/** The saturation seed (0–100). */
|
|
713
713
|
readonly saturation: number;
|
|
714
|
+
/** The effective config for this theme. */
|
|
715
|
+
getConfig(): GlazeConfigResolved;
|
|
714
716
|
/** Add/replace colors (additive merge with existing definitions). */
|
|
715
717
|
colors(defs: ColorMap): void;
|
|
716
718
|
/** Get a color definition by name. */
|
|
@@ -857,7 +859,7 @@ type PaletteInput = Record<string, GlazeTheme>;
|
|
|
857
859
|
* Create a single-hue glaze theme.
|
|
858
860
|
*
|
|
859
861
|
* An optional `config` override can be supplied to customize the resolve
|
|
860
|
-
* behavior for this theme (tone windows,
|
|
862
|
+
* behavior for this theme (tone windows, etc.). The
|
|
861
863
|
* override is **merged over the live global config at resolve time** —
|
|
862
864
|
* the theme still reacts to later `configure()` calls for fields it
|
|
863
865
|
* didn't override.
|
|
@@ -881,7 +883,7 @@ declare namespace glaze {
|
|
|
881
883
|
var from: (data: GlazeThemeExport) => GlazeTheme;
|
|
882
884
|
var color: (input: GlazeFromInput | GlazeColorInput | GlazeColorValue, config?: GlazeConfigOverride) => GlazeColorToken;
|
|
883
885
|
var shadow: (input: GlazeShadowInput) => ResolvedColorVariant;
|
|
884
|
-
var format: (variant: ResolvedColorVariant, colorFormat?: GlazeColorFormat) => string;
|
|
886
|
+
var format: (variant: ResolvedColorVariant, colorFormat?: GlazeColorFormat, pastel?: boolean) => string;
|
|
885
887
|
var fromHex: (hex: string) => GlazeTheme;
|
|
886
888
|
var fromRgb: (r: number, g: number, b: number) => GlazeTheme;
|
|
887
889
|
var colorFrom: (data: GlazeColorTokenExport) => GlazeColorToken;
|
|
@@ -956,15 +958,25 @@ type Vec3 = [number, number, number];
|
|
|
956
958
|
* OKHSL toe function: maps OKLab lightness L to perceptual lightness l.
|
|
957
959
|
* Exported for the OKHST tone transfers in `okhst.ts`.
|
|
958
960
|
*/
|
|
961
|
+
/**
|
|
962
|
+
* OKHSL lightness of the gamut cusp for a hue — the lightness where the
|
|
963
|
+
* realizable chroma peaks. Reuses the same `find_cusp` OKHSL already runs for
|
|
964
|
+
* its `s` normalization (no new color math); the OKLab cusp lightness is run
|
|
965
|
+
* through the OKHSL `toe` and clamped to `[0.001, 0.999]` so divisions that
|
|
966
|
+
* key off it stay safe. Cached per (rounded) hue.
|
|
967
|
+
*
|
|
968
|
+
* @param h Hue, 0–360.
|
|
969
|
+
*/
|
|
970
|
+
declare function cuspLightness(h: number): number;
|
|
959
971
|
/**
|
|
960
972
|
* Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to OKLab [L, a, b].
|
|
961
973
|
*/
|
|
962
|
-
declare function okhslToOklab(h: number, s: number, l: number): [number, number, number];
|
|
974
|
+
declare function okhslToOklab(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
|
|
963
975
|
/**
|
|
964
976
|
* Convert OKHSL (h: 0–360, s: 0–1, l: 0–1) to linear sRGB.
|
|
965
977
|
* Channels may exceed [0, 1] near gamut boundaries — caller must clamp if needed.
|
|
966
978
|
*/
|
|
967
|
-
declare function okhslToLinearSrgb(h: number, s: number, l: number): [number, number, number];
|
|
979
|
+
declare function okhslToLinearSrgb(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
|
|
968
980
|
/**
|
|
969
981
|
* Compute relative luminance Y from linear sRGB channels.
|
|
970
982
|
* Per WCAG 2: Y = 0.2126·R + 0.7152·G + 0.0722·B
|
|
@@ -977,7 +989,7 @@ declare function contrastRatioFromLuminance(yA: number, yB: number): number;
|
|
|
977
989
|
/**
|
|
978
990
|
* Convert OKHSL to gamma-encoded sRGB (clamped to 0–1).
|
|
979
991
|
*/
|
|
980
|
-
declare function okhslToSrgb(h: number, s: number, l: number): [number, number, number];
|
|
992
|
+
declare function okhslToSrgb(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
|
|
981
993
|
/**
|
|
982
994
|
* Compute WCAG 2 relative luminance from linear sRGB, matching the browser
|
|
983
995
|
* rendering pipeline: gamma-encode, clamp to sRGB gamut [0,1], then linearize.
|
|
@@ -989,12 +1001,12 @@ declare function gamutClampedLuminance(linearRgb: [number, number, number]): num
|
|
|
989
1001
|
* Input: [L, a, b] where L: 0–1, a/b: roughly -0.5 to 0.5.
|
|
990
1002
|
* Returns [h, s, l] where h: 0–360, s: 0–1, l: 0–1.
|
|
991
1003
|
*/
|
|
992
|
-
declare const oklabToOkhsl: (lab: Vec3) => Vec3;
|
|
1004
|
+
declare const oklabToOkhsl: (lab: Vec3, pastel?: boolean) => Vec3;
|
|
993
1005
|
/**
|
|
994
1006
|
* Convert gamma-encoded sRGB (0–1 per channel) to OKHSL.
|
|
995
1007
|
* Returns [h, s, l] where h: 0–360, s: 0–1, l: 0–1.
|
|
996
1008
|
*/
|
|
997
|
-
declare function srgbToOkhsl(rgb: [number, number, number]): [number, number, number];
|
|
1009
|
+
declare function srgbToOkhsl(rgb: [number, number, number], pastel?: boolean): [number, number, number];
|
|
998
1010
|
/**
|
|
999
1011
|
* Convert CSS HSL (sRGB-based) to gamma-encoded sRGB [r, g, b] in 0–1 range.
|
|
1000
1012
|
* h: 0–360, s: 0–1, l: 0–1.
|
|
@@ -1024,23 +1036,23 @@ declare function parseHexAlpha(hex: string): {
|
|
|
1024
1036
|
* Format OKHSL values as a CSS `okhsl(H S% L%)` string.
|
|
1025
1037
|
* h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
|
|
1026
1038
|
*/
|
|
1027
|
-
declare function formatOkhsl(h: number, s: number, l: number): string;
|
|
1039
|
+
declare function formatOkhsl(h: number, s: number, l: number, pastel?: boolean): string;
|
|
1028
1040
|
/**
|
|
1029
1041
|
* Format OKHSL values as a CSS `rgb(R G B)` string.
|
|
1030
1042
|
* Uses 2 decimal places to avoid 8-bit quantization contrast loss.
|
|
1031
1043
|
* h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
|
|
1032
1044
|
*/
|
|
1033
|
-
declare function formatRgb(h: number, s: number, l: number): string;
|
|
1045
|
+
declare function formatRgb(h: number, s: number, l: number, pastel?: boolean): string;
|
|
1034
1046
|
/**
|
|
1035
1047
|
* Format OKHSL values as a CSS `hsl(H S% L%)` string.
|
|
1036
1048
|
* h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
|
|
1037
1049
|
*/
|
|
1038
|
-
declare function formatHsl(h: number, s: number, l: number): string;
|
|
1050
|
+
declare function formatHsl(h: number, s: number, l: number, pastel?: boolean): string;
|
|
1039
1051
|
/**
|
|
1040
1052
|
* Format OKHSL values as a CSS `oklch(L C H)` string.
|
|
1041
1053
|
* h: 0–360, s: 0–100, l: 0–100 (percentage scale for s and l).
|
|
1042
1054
|
*/
|
|
1043
|
-
declare function formatOklch(h: number, s: number, l: number): string;
|
|
1055
|
+
declare function formatOklch(h: number, s: number, l: number, pastel?: boolean): string;
|
|
1044
1056
|
//#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 };
|
|
1057
|
+
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
1058
|
//# sourceMappingURL=index.d.mts.map
|