@tenphi/glaze 1.1.0 → 1.2.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/dist/index.cjs +246 -95
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +98 -6
- package/dist/index.d.mts +98 -6
- package/dist/index.mjs +246 -95
- package/dist/index.mjs.map +1 -1
- package/docs/api.md +90 -7
- package/docs/methodology.md +28 -0
- package/docs/okhst.md +21 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -248,6 +248,26 @@ interface RegularColorDef {
|
|
|
248
248
|
* - String ('+N' / '-N'): relative to the theme seed hue.
|
|
249
249
|
*/
|
|
250
250
|
hue?: number | RelativeValue;
|
|
251
|
+
/**
|
|
252
|
+
* Dark-scheme hue override. Applies to the `dark` and `darkContrast`
|
|
253
|
+
* variants; falls back to `hue` when omitted.
|
|
254
|
+
* - Number: absolute hue (0–360).
|
|
255
|
+
* - String ('+N' / '-N'): relative to the theme's **dark** seed hue
|
|
256
|
+
* (`GlazeTheme.darkHue`, itself defaulting to the light seed hue).
|
|
257
|
+
*
|
|
258
|
+
* Ignored under `mode: 'static'`, which pins one value across all schemes.
|
|
259
|
+
*/
|
|
260
|
+
darkHue?: number | RelativeValue;
|
|
261
|
+
/**
|
|
262
|
+
* Dark-scheme saturation factor (0–1) applied to the dark seed
|
|
263
|
+
* saturation. Applies to the `dark` and `darkContrast` variants; falls
|
|
264
|
+
* back to `saturation` when omitted.
|
|
265
|
+
*
|
|
266
|
+
* When set, the global `darkDesaturation` reduction is **not** applied on
|
|
267
|
+
* top — the resulting saturation is taken literally. Ignored under
|
|
268
|
+
* `mode: 'static'`.
|
|
269
|
+
*/
|
|
270
|
+
darkSaturation?: number;
|
|
251
271
|
/** Name of another color in the same theme (dependent color). */
|
|
252
272
|
base?: string;
|
|
253
273
|
/**
|
|
@@ -261,7 +281,8 @@ interface RegularColorDef {
|
|
|
261
281
|
* Whether to flip out-of-bounds results to the opposite side instead of
|
|
262
282
|
* clamping to the extreme. Affects both:
|
|
263
283
|
* - relative `tone`: when `base ± delta` exceeds `[0, 100]`, mirror the
|
|
264
|
-
* delta to the other side of the base.
|
|
284
|
+
* delta to the other side of the base. If the mirrored target is also
|
|
285
|
+
* out of range, keep the original delta and clamp on the authored side.
|
|
265
286
|
* - `contrast`: when the requested direction can't meet the floor, try the
|
|
266
287
|
* opposite side (same as the global `autoFlip`).
|
|
267
288
|
*
|
|
@@ -571,6 +592,10 @@ interface GlazeThemeExport {
|
|
|
571
592
|
version?: number;
|
|
572
593
|
hue: number;
|
|
573
594
|
saturation: number;
|
|
595
|
+
/** Dark-scheme seed hue (0–360). Omitted when the theme reuses `hue`. */
|
|
596
|
+
darkHue?: number;
|
|
597
|
+
/** Dark-scheme seed saturation (0–100). Omitted when the theme reuses `saturation`. */
|
|
598
|
+
darkSaturation?: number;
|
|
574
599
|
colors: ColorMap;
|
|
575
600
|
/**
|
|
576
601
|
* Effective config freeze from `.export()` —
|
|
@@ -603,6 +628,15 @@ interface GlazeColorInput {
|
|
|
603
628
|
saturation: number;
|
|
604
629
|
tone: HCPair<number | ExtremeValue>;
|
|
605
630
|
saturationFactor?: number;
|
|
631
|
+
/**
|
|
632
|
+
* Dark-scheme hue. Number is absolute (0–360); `'+N'`/`'-N'` is relative
|
|
633
|
+
* to the dark seed hue, which defaults to `hue`. Falls back to `hue`.
|
|
634
|
+
*/
|
|
635
|
+
darkHue?: number | RelativeValue;
|
|
636
|
+
/** Dark-scheme seed saturation (0–100). Defaults to `saturation`. */
|
|
637
|
+
darkSaturation?: number;
|
|
638
|
+
/** Dark-scheme multiplier on the dark seed (0–1). Defaults to `saturationFactor`. */
|
|
639
|
+
darkSaturationFactor?: number;
|
|
606
640
|
mode?: AdaptationMode;
|
|
607
641
|
/** Flip out-of-bounds results instead of clamping. Default: global `autoFlip`. */
|
|
608
642
|
autoFlip?: boolean;
|
|
@@ -672,6 +706,23 @@ interface GlazeColorOverrides {
|
|
|
672
706
|
hue?: number | RelativeValue;
|
|
673
707
|
/** Override seed saturation (0–100). Default: extracted from value. */
|
|
674
708
|
saturation?: number;
|
|
709
|
+
/**
|
|
710
|
+
* Dark-scheme hue. Number is absolute (0–360); `'+N'`/`'-N'` is relative
|
|
711
|
+
* to the dark seed hue, which defaults to the (possibly overridden) seed
|
|
712
|
+
* hue. Falls back to `hue` when omitted.
|
|
713
|
+
*/
|
|
714
|
+
darkHue?: number | RelativeValue;
|
|
715
|
+
/**
|
|
716
|
+
* Dark-scheme seed saturation (0–100). Defaults to `saturation`. When set,
|
|
717
|
+
* the global `darkDesaturation` reduction is not applied on top.
|
|
718
|
+
*/
|
|
719
|
+
darkSaturation?: number;
|
|
720
|
+
/**
|
|
721
|
+
* Dark-scheme multiplier on the dark seed (0–1). Defaults to
|
|
722
|
+
* `saturationFactor`. When set, the global `darkDesaturation` reduction is
|
|
723
|
+
* not applied on top.
|
|
724
|
+
*/
|
|
725
|
+
darkSaturationFactor?: number;
|
|
675
726
|
/**
|
|
676
727
|
* Override tone. Number is absolute (0–100, contrast-uniform); `'+N'`/`'-N'`
|
|
677
728
|
* is relative to the literal seed (the value passed to `glaze.color()`);
|
|
@@ -888,6 +939,9 @@ interface GlazeColorInputExport {
|
|
|
888
939
|
saturation: number;
|
|
889
940
|
tone: HCPair<number | ExtremeValue>;
|
|
890
941
|
saturationFactor?: number;
|
|
942
|
+
darkHue?: number | RelativeValue;
|
|
943
|
+
darkSaturation?: number;
|
|
944
|
+
darkSaturationFactor?: number;
|
|
891
945
|
mode?: AdaptationMode;
|
|
892
946
|
autoFlip?: boolean;
|
|
893
947
|
opacity?: number;
|
|
@@ -904,6 +958,9 @@ interface GlazeColorInputExport {
|
|
|
904
958
|
interface GlazeColorOverridesExport {
|
|
905
959
|
hue?: number | RelativeValue;
|
|
906
960
|
saturation?: number;
|
|
961
|
+
darkHue?: number | RelativeValue;
|
|
962
|
+
darkSaturation?: number;
|
|
963
|
+
darkSaturationFactor?: number;
|
|
907
964
|
tone?: HCPair<ToneValue>;
|
|
908
965
|
saturationFactor?: number;
|
|
909
966
|
mode?: AdaptationMode;
|
|
@@ -915,11 +972,33 @@ interface GlazeColorOverridesExport {
|
|
|
915
972
|
pastel?: boolean;
|
|
916
973
|
role?: RoleInput;
|
|
917
974
|
}
|
|
975
|
+
/**
|
|
976
|
+
* The hue/saturation seed pair a theme resolves against.
|
|
977
|
+
*
|
|
978
|
+
* `darkHue` / `darkSaturation` are a separate seed for the `dark` and
|
|
979
|
+
* `darkContrast` variants; each falls back to its light counterpart. Setting
|
|
980
|
+
* `darkSaturation` opts the theme out of the global `darkDesaturation`
|
|
981
|
+
* reduction — the authored value is used literally.
|
|
982
|
+
*/
|
|
983
|
+
interface GlazeThemeSeed {
|
|
984
|
+
/** Light-scheme hue seed (0–360). */
|
|
985
|
+
hue: number;
|
|
986
|
+
/** Light-scheme saturation seed (0–100). */
|
|
987
|
+
saturation: number;
|
|
988
|
+
/** Dark-scheme hue seed (0–360). Defaults to `hue`. */
|
|
989
|
+
darkHue?: number;
|
|
990
|
+
/** Dark-scheme saturation seed (0–100). Defaults to `saturation`. */
|
|
991
|
+
darkSaturation?: number;
|
|
992
|
+
}
|
|
918
993
|
interface GlazeTheme {
|
|
919
994
|
/** The hue seed (0–360). */
|
|
920
995
|
readonly hue: number;
|
|
921
996
|
/** The saturation seed (0–100). */
|
|
922
997
|
readonly saturation: number;
|
|
998
|
+
/** The dark-scheme hue seed (0–360), or `undefined` when `hue` is reused. */
|
|
999
|
+
readonly darkHue: number | undefined;
|
|
1000
|
+
/** The dark-scheme saturation seed (0–100), or `undefined` when `saturation` is reused. */
|
|
1001
|
+
readonly darkSaturation: number | undefined;
|
|
923
1002
|
/** The effective config for this theme. */
|
|
924
1003
|
getConfig(): GlazeConfigResolved;
|
|
925
1004
|
/** Add/replace colors (additive merge with existing definitions). */
|
|
@@ -987,6 +1066,10 @@ interface GlazeTheme {
|
|
|
987
1066
|
interface GlazeExtendOptions {
|
|
988
1067
|
hue?: number;
|
|
989
1068
|
saturation?: number;
|
|
1069
|
+
/** Replace the dark-scheme hue seed (0–360). Defaults to the parent's. */
|
|
1070
|
+
darkHue?: number;
|
|
1071
|
+
/** Replace the dark-scheme saturation seed (0–100). Defaults to the parent's. */
|
|
1072
|
+
darkSaturation?: number;
|
|
990
1073
|
colors?: ColorMap;
|
|
991
1074
|
/** Config override for the child theme. Merged with the parent's override. */
|
|
992
1075
|
config?: GlazeConfigOverride;
|
|
@@ -1340,19 +1423,23 @@ type PaletteInput = Record<string, GlazeTheme>;
|
|
|
1340
1423
|
* the theme still reacts to later `configure()` calls for fields it
|
|
1341
1424
|
* didn't override.
|
|
1342
1425
|
*
|
|
1426
|
+
* The object form also accepts `darkHue` / `darkSaturation` — a separate
|
|
1427
|
+
* seed pair for the dark and dark-high-contrast schemes. Both default to
|
|
1428
|
+
* their light counterparts, and an explicit `darkSaturation` opts the theme
|
|
1429
|
+
* out of the global `darkDesaturation` reduction.
|
|
1430
|
+
*
|
|
1343
1431
|
* @example
|
|
1344
1432
|
* ```ts
|
|
1345
1433
|
* const primary = glaze(280, 80);
|
|
1346
1434
|
* // or shorthand:
|
|
1347
1435
|
* const primary = glaze({ hue: 280, saturation: 80 });
|
|
1436
|
+
* // with a retuned dark seed:
|
|
1437
|
+
* const primary = glaze({ hue: 280, saturation: 80, darkHue: 268, darkSaturation: 65 });
|
|
1348
1438
|
* // with config override:
|
|
1349
1439
|
* const raw = glaze(280, 80, { lightTone: false });
|
|
1350
1440
|
* ```
|
|
1351
1441
|
*/
|
|
1352
|
-
declare function glaze(hueOrOptions: number |
|
|
1353
|
-
hue: number;
|
|
1354
|
-
saturation: number;
|
|
1355
|
-
}, saturation?: number, config?: GlazeConfigOverride): GlazeTheme;
|
|
1442
|
+
declare function glaze(hueOrOptions: number | GlazeThemeSeed, saturation?: number, config?: GlazeConfigOverride): GlazeTheme;
|
|
1356
1443
|
declare namespace glaze {
|
|
1357
1444
|
var configure: (config: GlazeConfig) => void;
|
|
1358
1445
|
var palette: (themes: PaletteInput, options?: GlazePaletteOptions) => GlazePalette;
|
|
@@ -1387,6 +1474,11 @@ interface HuePlan {
|
|
|
1387
1474
|
}
|
|
1388
1475
|
interface ChannelCtx {
|
|
1389
1476
|
seedHue: number;
|
|
1477
|
+
/**
|
|
1478
|
+
* Dark-scheme seed hue, when the theme authored one. Drives the dark
|
|
1479
|
+
* `--{baseName}-hue` value; falls back to `seedHue`.
|
|
1480
|
+
*/
|
|
1481
|
+
darkSeedHue?: number;
|
|
1390
1482
|
/** Theme-level hue var base name (without `--` / `-hue`). */
|
|
1391
1483
|
baseName: string;
|
|
1392
1484
|
/** Token / custom-property name prefix used for hue var naming (`brand-` etc.). */
|
|
@@ -1631,5 +1723,5 @@ declare function srgbToHex(rgb: [number, number, number]): `#${string}`;
|
|
|
1631
1723
|
*/
|
|
1632
1724
|
declare function okhslToOklch(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
|
|
1633
1725
|
//#endregion
|
|
1634
|
-
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 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, resolveContrastForMode, resolveMinContrast, roleToPolarity, srgbToHex, srgbToOkhsl, toTone, toneFromY, variantToOkhsl, yFromTone };
|
|
1726
|
+
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, resolveContrastForMode, resolveMinContrast, roleToPolarity, srgbToHex, srgbToOkhsl, toTone, toneFromY, variantToOkhsl, yFromTone };
|
|
1635
1727
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -248,6 +248,26 @@ interface RegularColorDef {
|
|
|
248
248
|
* - String ('+N' / '-N'): relative to the theme seed hue.
|
|
249
249
|
*/
|
|
250
250
|
hue?: number | RelativeValue;
|
|
251
|
+
/**
|
|
252
|
+
* Dark-scheme hue override. Applies to the `dark` and `darkContrast`
|
|
253
|
+
* variants; falls back to `hue` when omitted.
|
|
254
|
+
* - Number: absolute hue (0–360).
|
|
255
|
+
* - String ('+N' / '-N'): relative to the theme's **dark** seed hue
|
|
256
|
+
* (`GlazeTheme.darkHue`, itself defaulting to the light seed hue).
|
|
257
|
+
*
|
|
258
|
+
* Ignored under `mode: 'static'`, which pins one value across all schemes.
|
|
259
|
+
*/
|
|
260
|
+
darkHue?: number | RelativeValue;
|
|
261
|
+
/**
|
|
262
|
+
* Dark-scheme saturation factor (0–1) applied to the dark seed
|
|
263
|
+
* saturation. Applies to the `dark` and `darkContrast` variants; falls
|
|
264
|
+
* back to `saturation` when omitted.
|
|
265
|
+
*
|
|
266
|
+
* When set, the global `darkDesaturation` reduction is **not** applied on
|
|
267
|
+
* top — the resulting saturation is taken literally. Ignored under
|
|
268
|
+
* `mode: 'static'`.
|
|
269
|
+
*/
|
|
270
|
+
darkSaturation?: number;
|
|
251
271
|
/** Name of another color in the same theme (dependent color). */
|
|
252
272
|
base?: string;
|
|
253
273
|
/**
|
|
@@ -261,7 +281,8 @@ interface RegularColorDef {
|
|
|
261
281
|
* Whether to flip out-of-bounds results to the opposite side instead of
|
|
262
282
|
* clamping to the extreme. Affects both:
|
|
263
283
|
* - relative `tone`: when `base ± delta` exceeds `[0, 100]`, mirror the
|
|
264
|
-
* delta to the other side of the base.
|
|
284
|
+
* delta to the other side of the base. If the mirrored target is also
|
|
285
|
+
* out of range, keep the original delta and clamp on the authored side.
|
|
265
286
|
* - `contrast`: when the requested direction can't meet the floor, try the
|
|
266
287
|
* opposite side (same as the global `autoFlip`).
|
|
267
288
|
*
|
|
@@ -571,6 +592,10 @@ interface GlazeThemeExport {
|
|
|
571
592
|
version?: number;
|
|
572
593
|
hue: number;
|
|
573
594
|
saturation: number;
|
|
595
|
+
/** Dark-scheme seed hue (0–360). Omitted when the theme reuses `hue`. */
|
|
596
|
+
darkHue?: number;
|
|
597
|
+
/** Dark-scheme seed saturation (0–100). Omitted when the theme reuses `saturation`. */
|
|
598
|
+
darkSaturation?: number;
|
|
574
599
|
colors: ColorMap;
|
|
575
600
|
/**
|
|
576
601
|
* Effective config freeze from `.export()` —
|
|
@@ -603,6 +628,15 @@ interface GlazeColorInput {
|
|
|
603
628
|
saturation: number;
|
|
604
629
|
tone: HCPair<number | ExtremeValue>;
|
|
605
630
|
saturationFactor?: number;
|
|
631
|
+
/**
|
|
632
|
+
* Dark-scheme hue. Number is absolute (0–360); `'+N'`/`'-N'` is relative
|
|
633
|
+
* to the dark seed hue, which defaults to `hue`. Falls back to `hue`.
|
|
634
|
+
*/
|
|
635
|
+
darkHue?: number | RelativeValue;
|
|
636
|
+
/** Dark-scheme seed saturation (0–100). Defaults to `saturation`. */
|
|
637
|
+
darkSaturation?: number;
|
|
638
|
+
/** Dark-scheme multiplier on the dark seed (0–1). Defaults to `saturationFactor`. */
|
|
639
|
+
darkSaturationFactor?: number;
|
|
606
640
|
mode?: AdaptationMode;
|
|
607
641
|
/** Flip out-of-bounds results instead of clamping. Default: global `autoFlip`. */
|
|
608
642
|
autoFlip?: boolean;
|
|
@@ -672,6 +706,23 @@ interface GlazeColorOverrides {
|
|
|
672
706
|
hue?: number | RelativeValue;
|
|
673
707
|
/** Override seed saturation (0–100). Default: extracted from value. */
|
|
674
708
|
saturation?: number;
|
|
709
|
+
/**
|
|
710
|
+
* Dark-scheme hue. Number is absolute (0–360); `'+N'`/`'-N'` is relative
|
|
711
|
+
* to the dark seed hue, which defaults to the (possibly overridden) seed
|
|
712
|
+
* hue. Falls back to `hue` when omitted.
|
|
713
|
+
*/
|
|
714
|
+
darkHue?: number | RelativeValue;
|
|
715
|
+
/**
|
|
716
|
+
* Dark-scheme seed saturation (0–100). Defaults to `saturation`. When set,
|
|
717
|
+
* the global `darkDesaturation` reduction is not applied on top.
|
|
718
|
+
*/
|
|
719
|
+
darkSaturation?: number;
|
|
720
|
+
/**
|
|
721
|
+
* Dark-scheme multiplier on the dark seed (0–1). Defaults to
|
|
722
|
+
* `saturationFactor`. When set, the global `darkDesaturation` reduction is
|
|
723
|
+
* not applied on top.
|
|
724
|
+
*/
|
|
725
|
+
darkSaturationFactor?: number;
|
|
675
726
|
/**
|
|
676
727
|
* Override tone. Number is absolute (0–100, contrast-uniform); `'+N'`/`'-N'`
|
|
677
728
|
* is relative to the literal seed (the value passed to `glaze.color()`);
|
|
@@ -888,6 +939,9 @@ interface GlazeColorInputExport {
|
|
|
888
939
|
saturation: number;
|
|
889
940
|
tone: HCPair<number | ExtremeValue>;
|
|
890
941
|
saturationFactor?: number;
|
|
942
|
+
darkHue?: number | RelativeValue;
|
|
943
|
+
darkSaturation?: number;
|
|
944
|
+
darkSaturationFactor?: number;
|
|
891
945
|
mode?: AdaptationMode;
|
|
892
946
|
autoFlip?: boolean;
|
|
893
947
|
opacity?: number;
|
|
@@ -904,6 +958,9 @@ interface GlazeColorInputExport {
|
|
|
904
958
|
interface GlazeColorOverridesExport {
|
|
905
959
|
hue?: number | RelativeValue;
|
|
906
960
|
saturation?: number;
|
|
961
|
+
darkHue?: number | RelativeValue;
|
|
962
|
+
darkSaturation?: number;
|
|
963
|
+
darkSaturationFactor?: number;
|
|
907
964
|
tone?: HCPair<ToneValue>;
|
|
908
965
|
saturationFactor?: number;
|
|
909
966
|
mode?: AdaptationMode;
|
|
@@ -915,11 +972,33 @@ interface GlazeColorOverridesExport {
|
|
|
915
972
|
pastel?: boolean;
|
|
916
973
|
role?: RoleInput;
|
|
917
974
|
}
|
|
975
|
+
/**
|
|
976
|
+
* The hue/saturation seed pair a theme resolves against.
|
|
977
|
+
*
|
|
978
|
+
* `darkHue` / `darkSaturation` are a separate seed for the `dark` and
|
|
979
|
+
* `darkContrast` variants; each falls back to its light counterpart. Setting
|
|
980
|
+
* `darkSaturation` opts the theme out of the global `darkDesaturation`
|
|
981
|
+
* reduction — the authored value is used literally.
|
|
982
|
+
*/
|
|
983
|
+
interface GlazeThemeSeed {
|
|
984
|
+
/** Light-scheme hue seed (0–360). */
|
|
985
|
+
hue: number;
|
|
986
|
+
/** Light-scheme saturation seed (0–100). */
|
|
987
|
+
saturation: number;
|
|
988
|
+
/** Dark-scheme hue seed (0–360). Defaults to `hue`. */
|
|
989
|
+
darkHue?: number;
|
|
990
|
+
/** Dark-scheme saturation seed (0–100). Defaults to `saturation`. */
|
|
991
|
+
darkSaturation?: number;
|
|
992
|
+
}
|
|
918
993
|
interface GlazeTheme {
|
|
919
994
|
/** The hue seed (0–360). */
|
|
920
995
|
readonly hue: number;
|
|
921
996
|
/** The saturation seed (0–100). */
|
|
922
997
|
readonly saturation: number;
|
|
998
|
+
/** The dark-scheme hue seed (0–360), or `undefined` when `hue` is reused. */
|
|
999
|
+
readonly darkHue: number | undefined;
|
|
1000
|
+
/** The dark-scheme saturation seed (0–100), or `undefined` when `saturation` is reused. */
|
|
1001
|
+
readonly darkSaturation: number | undefined;
|
|
923
1002
|
/** The effective config for this theme. */
|
|
924
1003
|
getConfig(): GlazeConfigResolved;
|
|
925
1004
|
/** Add/replace colors (additive merge with existing definitions). */
|
|
@@ -987,6 +1066,10 @@ interface GlazeTheme {
|
|
|
987
1066
|
interface GlazeExtendOptions {
|
|
988
1067
|
hue?: number;
|
|
989
1068
|
saturation?: number;
|
|
1069
|
+
/** Replace the dark-scheme hue seed (0–360). Defaults to the parent's. */
|
|
1070
|
+
darkHue?: number;
|
|
1071
|
+
/** Replace the dark-scheme saturation seed (0–100). Defaults to the parent's. */
|
|
1072
|
+
darkSaturation?: number;
|
|
990
1073
|
colors?: ColorMap;
|
|
991
1074
|
/** Config override for the child theme. Merged with the parent's override. */
|
|
992
1075
|
config?: GlazeConfigOverride;
|
|
@@ -1340,19 +1423,23 @@ type PaletteInput = Record<string, GlazeTheme>;
|
|
|
1340
1423
|
* the theme still reacts to later `configure()` calls for fields it
|
|
1341
1424
|
* didn't override.
|
|
1342
1425
|
*
|
|
1426
|
+
* The object form also accepts `darkHue` / `darkSaturation` — a separate
|
|
1427
|
+
* seed pair for the dark and dark-high-contrast schemes. Both default to
|
|
1428
|
+
* their light counterparts, and an explicit `darkSaturation` opts the theme
|
|
1429
|
+
* out of the global `darkDesaturation` reduction.
|
|
1430
|
+
*
|
|
1343
1431
|
* @example
|
|
1344
1432
|
* ```ts
|
|
1345
1433
|
* const primary = glaze(280, 80);
|
|
1346
1434
|
* // or shorthand:
|
|
1347
1435
|
* const primary = glaze({ hue: 280, saturation: 80 });
|
|
1436
|
+
* // with a retuned dark seed:
|
|
1437
|
+
* const primary = glaze({ hue: 280, saturation: 80, darkHue: 268, darkSaturation: 65 });
|
|
1348
1438
|
* // with config override:
|
|
1349
1439
|
* const raw = glaze(280, 80, { lightTone: false });
|
|
1350
1440
|
* ```
|
|
1351
1441
|
*/
|
|
1352
|
-
declare function glaze(hueOrOptions: number |
|
|
1353
|
-
hue: number;
|
|
1354
|
-
saturation: number;
|
|
1355
|
-
}, saturation?: number, config?: GlazeConfigOverride): GlazeTheme;
|
|
1442
|
+
declare function glaze(hueOrOptions: number | GlazeThemeSeed, saturation?: number, config?: GlazeConfigOverride): GlazeTheme;
|
|
1356
1443
|
declare namespace glaze {
|
|
1357
1444
|
var configure: (config: GlazeConfig) => void;
|
|
1358
1445
|
var palette: (themes: PaletteInput, options?: GlazePaletteOptions) => GlazePalette;
|
|
@@ -1387,6 +1474,11 @@ interface HuePlan {
|
|
|
1387
1474
|
}
|
|
1388
1475
|
interface ChannelCtx {
|
|
1389
1476
|
seedHue: number;
|
|
1477
|
+
/**
|
|
1478
|
+
* Dark-scheme seed hue, when the theme authored one. Drives the dark
|
|
1479
|
+
* `--{baseName}-hue` value; falls back to `seedHue`.
|
|
1480
|
+
*/
|
|
1481
|
+
darkSeedHue?: number;
|
|
1390
1482
|
/** Theme-level hue var base name (without `--` / `-hue`). */
|
|
1391
1483
|
baseName: string;
|
|
1392
1484
|
/** Token / custom-property name prefix used for hue var naming (`brand-` etc.). */
|
|
@@ -1631,5 +1723,5 @@ declare function srgbToHex(rgb: [number, number, number]): `#${string}`;
|
|
|
1631
1723
|
*/
|
|
1632
1724
|
declare function okhslToOklch(h: number, s: number, l: number, pastel?: boolean): [number, number, number];
|
|
1633
1725
|
//#endregion
|
|
1634
|
-
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 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, resolveContrastForMode, resolveMinContrast, roleToPolarity, srgbToHex, srgbToOkhsl, toTone, toneFromY, variantToOkhsl, yFromTone };
|
|
1726
|
+
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, resolveContrastForMode, resolveMinContrast, roleToPolarity, srgbToHex, srgbToOkhsl, toTone, toneFromY, variantToOkhsl, yFromTone };
|
|
1635
1727
|
//# sourceMappingURL=index.d.mts.map
|