silvery 0.19.2 → 0.21.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/README.md +9 -4
- package/dist/Text-BRf-59j2.mjs +237 -0
- package/dist/Text-BRf-59j2.mjs.map +1 -0
- package/dist/ag-BeFC4S2N.mjs +8727 -0
- package/dist/ag-BeFC4S2N.mjs.map +1 -0
- package/dist/{animation-Cn64yepo.mjs → animation-N8MFybTk.mjs} +2 -2
- package/dist/animation-N8MFybTk.mjs.map +1 -0
- package/dist/{ansi-CLOitHKx.mjs → ansi-C6Qs1Wn2.mjs} +1 -1
- package/dist/{ansi-CLOitHKx.mjs.map → ansi-C6Qs1Wn2.mjs.map} +1 -1
- package/dist/{ansi-Cc33mW54.d.mts → ansi-CBkam1ty.d.mts} +1 -1
- package/dist/{ansi-Cc33mW54.d.mts.map → ansi-CBkam1ty.d.mts.map} +1 -1
- package/dist/ansi-OYRLxxZQ.mjs +10669 -0
- package/dist/ansi-OYRLxxZQ.mjs.map +1 -0
- package/dist/bound-term-BumfuXXW.d.mts +4902 -0
- package/dist/bound-term-BumfuXXW.d.mts.map +1 -0
- package/dist/{chunk-Vs_PY4HZ.mjs → chunk-hT5z_Zn9.mjs} +1 -3
- package/dist/cli-DG6zsfsS.mjs +4 -0
- package/dist/context-BU5LkkIy.mjs.map +1 -1
- package/dist/{devtools-DxkSLXDA.mjs → devtools-9zfhpFyG.mjs} +3 -3
- package/dist/{devtools-DxkSLXDA.mjs.map → devtools-9zfhpFyG.mjs.map} +1 -1
- package/dist/devtools-nmPUmYU_.mjs +2 -0
- package/dist/easing-B0oZKDki.d.mts +24 -0
- package/dist/easing-B0oZKDki.d.mts.map +1 -0
- package/dist/{eta-Bb3RH3wh.mjs → eta-DGOuC8yU.mjs} +5 -1
- package/dist/{eta-Bb3RH3wh.mjs.map → eta-DGOuC8yU.mjs.map} +1 -1
- package/dist/flexily-zero-adapter-CEJOcbNp.mjs +306 -0
- package/dist/flexily-zero-adapter-CEJOcbNp.mjs.map +1 -0
- package/dist/{flexily-zero-adapter-CMxXhdOL.mjs → flexily-zero-adapter-D6hcFgrH.mjs} +1 -1
- package/dist/image-1nRyKa60.mjs +5960 -0
- package/dist/image-1nRyKa60.mjs.map +1 -0
- package/dist/{index-D3saHouR.d.mts → index-2E1jYgak.d.mts} +1057 -1133
- package/dist/index-2E1jYgak.d.mts.map +1 -0
- package/dist/index-Bi4Jdz5g.d.mts +453 -0
- package/dist/index-Bi4Jdz5g.d.mts.map +1 -0
- package/dist/index-Dg1YaeJb.d.mts +336 -0
- package/dist/index-Dg1YaeJb.d.mts.map +1 -0
- package/dist/{index-BXslOebb.d.mts → index-DnuadDNL.d.mts} +5750 -4158
- package/dist/index-DnuadDNL.d.mts.map +1 -0
- package/dist/index.d.mts +8 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +16 -12
- package/dist/index.mjs.map +1 -1
- package/dist/layout-engine-Ca_nbtfL.mjs +67 -0
- package/dist/layout-engine-Ca_nbtfL.mjs.map +1 -0
- package/dist/{layout-engine-B6Cdz1yZ.mjs → layout-engine-CgsoBRIn.mjs} +1 -1
- package/dist/layout-signals-Dch2EiCy.mjs +1111 -0
- package/dist/layout-signals-Dch2EiCy.mjs.map +1 -0
- package/dist/mouse-events-hnbJZRwK.mjs +1071 -0
- package/dist/mouse-events-hnbJZRwK.mjs.map +1 -0
- package/dist/{multi-progress-DAQC7eap.d.mts → multi-progress-Bg4ngK80.d.mts} +2 -2
- package/dist/{multi-progress-DAQC7eap.d.mts.map → multi-progress-Bg4ngK80.d.mts.map} +1 -1
- package/dist/{multi-progress-Bq9Oi_WI.mjs → multi-progress-CaXTuL9G.mjs} +3 -3
- package/dist/{multi-progress-Bq9Oi_WI.mjs.map → multi-progress-CaXTuL9G.mjs.map} +1 -1
- package/dist/{node-BeWlnCPY.mjs → node-BiFu8I9Y.mjs} +4 -4
- package/dist/node-BiFu8I9Y.mjs.map +1 -0
- package/dist/progress-B_UPy6zk.mjs +675 -0
- package/dist/progress-B_UPy6zk.mjs.map +1 -0
- package/dist/{progress-bar-CXE5Qfkd.mjs → progress-bar-DmIMPdL0.mjs} +4 -4
- package/dist/{progress-bar-CXE5Qfkd.mjs.map → progress-bar-DmIMPdL0.mjs.map} +1 -1
- package/dist/reconciler-NBDSEm8k.mjs +2178 -0
- package/dist/reconciler-NBDSEm8k.mjs.map +1 -0
- package/dist/render-string-B4h4SmK7.mjs +211 -0
- package/dist/render-string-B4h4SmK7.mjs.map +1 -0
- package/dist/{render-string-CDCeYkS3.mjs → render-string-BntLj7Xq.mjs} +1 -1
- package/dist/runtime.d.mts +3 -2
- package/dist/runtime.mjs +3 -3
- package/dist/{src-B5GjfG7g.mjs → schemes-DYt2ushj.mjs} +23 -1812
- package/dist/schemes-DYt2ushj.mjs.map +1 -0
- package/dist/{spinner-CGo34vyR.d.mts → spinner-CLgzJ_QF.d.mts} +2 -2
- package/dist/{spinner-CGo34vyR.d.mts.map → spinner-CLgzJ_QF.d.mts.map} +1 -1
- package/dist/{spinner-CeOmcuw_.mjs → spinner-Py8_-hn9.mjs} +23 -8
- package/dist/spinner-Py8_-hn9.mjs.map +1 -0
- package/dist/src-B9S_woYc.mjs +25024 -0
- package/dist/src-B9S_woYc.mjs.map +1 -0
- package/dist/src-CbhWmUnF.mjs +3928 -0
- package/dist/src-CbhWmUnF.mjs.map +1 -0
- package/dist/src-Dvq-s8iD.mjs +939 -0
- package/dist/src-Dvq-s8iD.mjs.map +1 -0
- package/dist/src-Oe6x5PrS.mjs +4621 -0
- package/dist/src-Oe6x5PrS.mjs.map +1 -0
- package/dist/{types-Bk2yw9Qj.mjs → src-WeA_J4BV.mjs} +34 -94
- package/dist/src-WeA_J4BV.mjs.map +1 -0
- package/dist/steps-DYrzCUCK.d.mts +202 -0
- package/dist/steps-DYrzCUCK.d.mts.map +1 -0
- package/dist/svg-DhxQkz-O.mjs +255 -0
- package/dist/svg-DhxQkz-O.mjs.map +1 -0
- package/dist/svg-Hk7lIl4F.d.mts +82 -0
- package/dist/svg-Hk7lIl4F.d.mts.map +1 -0
- package/dist/term.d.mts +3 -0
- package/dist/term.mjs +4 -0
- package/dist/theme.d.mts +95 -2
- package/dist/theme.d.mts.map +1 -0
- package/dist/theme.mjs +4 -3
- package/dist/{types-BH_v3iMT.d.mts → types-Bx-XZNbE.d.mts} +2 -15
- package/dist/types-Bx-XZNbE.d.mts.map +1 -0
- package/dist/ui/animation.d.mts +2 -1
- package/dist/ui/animation.mjs +1 -1
- package/dist/ui/ansi.d.mts +1 -1
- package/dist/ui/ansi.mjs +1 -1
- package/dist/ui/cli.d.mts +3 -3
- package/dist/ui/cli.mjs +5 -5
- package/dist/ui/display.d.mts +1 -1
- package/dist/ui/display.mjs.map +1 -1
- package/dist/ui/image.d.mts +2 -2
- package/dist/ui/image.mjs +2 -2
- package/dist/ui/input.d.mts +1 -1
- package/dist/ui/input.mjs.map +1 -1
- package/dist/ui/progress.d.mts +5 -249
- package/dist/ui/progress.mjs +5 -858
- package/dist/ui/react.d.mts +1 -1
- package/dist/ui/react.mjs +2 -2
- package/dist/ui/react.mjs.map +1 -1
- package/dist/ui/recording-chrome-react.d.mts +21 -0
- package/dist/ui/recording-chrome-react.d.mts.map +1 -0
- package/dist/ui/recording-chrome-react.mjs +105 -0
- package/dist/ui/recording-chrome-react.mjs.map +1 -0
- package/dist/ui/recording-chrome.d.mts +2 -0
- package/dist/ui/recording-chrome.mjs +2 -0
- package/dist/ui/utils.mjs +1 -1
- package/dist/ui/wrappers.d.mts +3 -3
- package/dist/ui/wrappers.mjs +2 -2
- package/dist/ui.d.mts +7 -6
- package/dist/ui.mjs +8 -7
- package/dist/{useLatest-Bg2x4bfP.d.mts → useLatest-DC8i7guK.d.mts} +5 -25
- package/dist/useLatest-DC8i7guK.d.mts.map +1 -0
- package/dist/useLayout-BKsQl2Or.mjs +424 -0
- package/dist/useLayout-BKsQl2Or.mjs.map +1 -0
- package/dist/{with-text-input-CRfoiFFG.d.mts → with-text-input-DG4f7JII.d.mts} +4 -55
- package/dist/with-text-input-DG4f7JII.d.mts.map +1 -0
- package/dist/wrapper-D7gNSsgf.mjs +3589 -0
- package/dist/wrapper-D7gNSsgf.mjs.map +1 -0
- package/dist/{wrappers-UTADQkSY.mjs → wrappers-CypAzrMO.mjs} +19 -161
- package/dist/wrappers-CypAzrMO.mjs.map +1 -0
- package/dist/yoga-adapter-1ex8r0ws.mjs +2 -0
- package/dist/{yoga-adapter-8oRGRw8V.mjs → yoga-adapter-SsEIqMc1.mjs} +28 -2
- package/dist/yoga-adapter-SsEIqMc1.mjs.map +1 -0
- package/package.json +63 -12
- package/dist/animation-Cn64yepo.mjs.map +0 -1
- package/dist/cli-BKp0YtBD.mjs +0 -4
- package/dist/devtools-9QY4teqI.mjs +0 -2
- package/dist/flexily-zero-adapter-BlQa46nr.mjs +0 -3385
- package/dist/flexily-zero-adapter-BlQa46nr.mjs.map +0 -1
- package/dist/image-CTII5QWI.mjs +0 -477
- package/dist/image-CTII5QWI.mjs.map +0 -1
- package/dist/index-BXslOebb.d.mts.map +0 -1
- package/dist/index-BnA7mNpo.d.mts +0 -175
- package/dist/index-BnA7mNpo.d.mts.map +0 -1
- package/dist/index-D3saHouR.d.mts.map +0 -1
- package/dist/layout-engine-ClUgv6jB.mjs +0 -50
- package/dist/layout-engine-ClUgv6jB.mjs.map +0 -1
- package/dist/node-BeWlnCPY.mjs.map +0 -1
- package/dist/reconciler-Cwgm8hRR.mjs +0 -8459
- package/dist/reconciler-Cwgm8hRR.mjs.map +0 -1
- package/dist/render-string-Darrg7ku.mjs +0 -5529
- package/dist/render-string-Darrg7ku.mjs.map +0 -1
- package/dist/spinner-CeOmcuw_.mjs.map +0 -1
- package/dist/src-B5GjfG7g.mjs.map +0 -1
- package/dist/src-CChwjk0Z.mjs +0 -738
- package/dist/src-CChwjk0Z.mjs.map +0 -1
- package/dist/src-CF-6UN01.mjs +0 -19434
- package/dist/src-CF-6UN01.mjs.map +0 -1
- package/dist/src-NCKb8kE5.mjs +0 -2660
- package/dist/src-NCKb8kE5.mjs.map +0 -1
- package/dist/types-BH_v3iMT.d.mts.map +0 -1
- package/dist/types-Bk2yw9Qj.mjs.map +0 -1
- package/dist/ui/progress.d.mts.map +0 -1
- package/dist/ui/progress.mjs.map +0 -1
- package/dist/useLatest-Bg2x4bfP.d.mts.map +0 -1
- package/dist/with-text-input-CRfoiFFG.d.mts.map +0 -1
- package/dist/wrappers-UTADQkSY.mjs.map +0 -1
- package/dist/yoga-adapter-8oRGRw8V.mjs.map +0 -1
- package/dist/yoga-adapter-D_CcxSt5.mjs +0 -2
|
@@ -1,820 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
//#region packages/theme/src/generate.ts
|
|
4
|
-
init_src();
|
|
5
|
-
/**
|
|
6
|
-
* Resolve an ANSI16 slot name (e.g. "yellow", "blueBright") to its canonical
|
|
7
|
-
* hex value. Falls back to the input string if not found (e.g., already hex).
|
|
8
|
-
*/
|
|
9
|
-
function slotHex(name) {
|
|
10
|
-
return ANSI16_SLOT_HEX[name] ?? name;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Generate a complete ANSI 16 theme from a primary color + dark/light preference.
|
|
14
|
-
*
|
|
15
|
-
* All token values are hex strings (e.g. "#808000" for yellow).
|
|
16
|
-
* Terminal rendering quantizes these to 4-bit ANSI codes at paint time
|
|
17
|
-
* when colorLevel === "basic".
|
|
18
|
-
*/
|
|
19
|
-
function generateTheme(primary, dark) {
|
|
20
|
-
const primaryHex = slotHex(primary);
|
|
21
|
-
const fgHex = slotHex(dark ? "whiteBright" : "black");
|
|
22
|
-
const accentHex = primaryHex;
|
|
23
|
-
const selectionbgHex = primaryHex;
|
|
24
|
-
const surfacebgHex = slotHex(dark ? "black" : "white");
|
|
25
|
-
const derived = deriveFields({
|
|
26
|
-
primary: primaryHex,
|
|
27
|
-
accent: accentHex,
|
|
28
|
-
fg: fgHex,
|
|
29
|
-
selectionbg: selectionbgHex,
|
|
30
|
-
surfacebg: surfacebgHex,
|
|
31
|
-
ring: {
|
|
32
|
-
red: slotHex(dark ? "redBright" : "red"),
|
|
33
|
-
orange: slotHex(dark ? "redBright" : "red"),
|
|
34
|
-
yellow: slotHex("yellow"),
|
|
35
|
-
green: slotHex(dark ? "greenBright" : "green"),
|
|
36
|
-
teal: slotHex("cyan"),
|
|
37
|
-
blue: slotHex(dark ? "blueBright" : "blue"),
|
|
38
|
-
purple: slotHex("magenta"),
|
|
39
|
-
pink: slotHex(dark ? "magentaBright" : "magenta")
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
return {
|
|
43
|
-
name: `${dark ? "dark" : "light"}-${primary}`,
|
|
44
|
-
bg: "",
|
|
45
|
-
fg: fgHex,
|
|
46
|
-
muted: slotHex(dark ? "white" : "blackBright"),
|
|
47
|
-
mutedbg: slotHex(dark ? "black" : "white"),
|
|
48
|
-
surface: slotHex(dark ? "whiteBright" : "black"),
|
|
49
|
-
surfacebg: surfacebgHex,
|
|
50
|
-
popover: slotHex(dark ? "whiteBright" : "black"),
|
|
51
|
-
popoverbg: slotHex(dark ? "blackBright" : "white"),
|
|
52
|
-
inverse: slotHex(dark ? "black" : "whiteBright"),
|
|
53
|
-
inversebg: slotHex(dark ? "whiteBright" : "black"),
|
|
54
|
-
cursor: slotHex("black"),
|
|
55
|
-
cursorbg: primaryHex,
|
|
56
|
-
selection: slotHex("black"),
|
|
57
|
-
selectionbg: primaryHex,
|
|
58
|
-
primary: primaryHex,
|
|
59
|
-
primaryfg: slotHex("black"),
|
|
60
|
-
secondary: primaryHex,
|
|
61
|
-
secondaryfg: slotHex("black"),
|
|
62
|
-
accent: primaryHex,
|
|
63
|
-
accentfg: slotHex("black"),
|
|
64
|
-
error: slotHex(dark ? "redBright" : "red"),
|
|
65
|
-
errorfg: slotHex("black"),
|
|
66
|
-
warning: primaryHex,
|
|
67
|
-
warningfg: slotHex("black"),
|
|
68
|
-
success: slotHex(dark ? "greenBright" : "green"),
|
|
69
|
-
successfg: slotHex("black"),
|
|
70
|
-
info: slotHex(dark ? "cyanBright" : "cyan"),
|
|
71
|
-
infofg: slotHex("black"),
|
|
72
|
-
border: slotHex("gray"),
|
|
73
|
-
inputborder: slotHex("gray"),
|
|
74
|
-
focusborder: slotHex(dark ? "blueBright" : "blue"),
|
|
75
|
-
link: slotHex("blueBright"),
|
|
76
|
-
disabledfg: slotHex("gray"),
|
|
77
|
-
palette: [
|
|
78
|
-
slotHex("black"),
|
|
79
|
-
slotHex("red"),
|
|
80
|
-
slotHex("green"),
|
|
81
|
-
slotHex("yellow"),
|
|
82
|
-
slotHex("blue"),
|
|
83
|
-
slotHex("magenta"),
|
|
84
|
-
slotHex("cyan"),
|
|
85
|
-
slotHex("white"),
|
|
86
|
-
slotHex("blackBright"),
|
|
87
|
-
slotHex("redBright"),
|
|
88
|
-
slotHex("greenBright"),
|
|
89
|
-
slotHex("yellowBright"),
|
|
90
|
-
slotHex("blueBright"),
|
|
91
|
-
slotHex("magentaBright"),
|
|
92
|
-
slotHex("cyanBright"),
|
|
93
|
-
slotHex("whiteBright")
|
|
94
|
-
],
|
|
95
|
-
...derived
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region packages/theme/src/import/types.ts
|
|
100
|
-
/** All Base16 color keys in order. */
|
|
101
|
-
const BASE16_KEYS = [
|
|
102
|
-
"base00",
|
|
103
|
-
"base01",
|
|
104
|
-
"base02",
|
|
105
|
-
"base03",
|
|
106
|
-
"base04",
|
|
107
|
-
"base05",
|
|
108
|
-
"base06",
|
|
109
|
-
"base07",
|
|
110
|
-
"base08",
|
|
111
|
-
"base09",
|
|
112
|
-
"base0A",
|
|
113
|
-
"base0B",
|
|
114
|
-
"base0C",
|
|
115
|
-
"base0D",
|
|
116
|
-
"base0E",
|
|
117
|
-
"base0F"
|
|
118
|
-
];
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region packages/theme/src/import/base16.ts
|
|
121
|
-
/**
|
|
122
|
-
* Import Base16 YAML/JSON schemes into ColorScheme format.
|
|
123
|
-
*
|
|
124
|
-
* Base16 defines 16 colors (base00–base0F). We map them to ColorScheme's
|
|
125
|
-
* 22 colors, deriving bright variants and special colors.
|
|
126
|
-
*
|
|
127
|
-
* @see https://github.com/chriskempson/base16
|
|
128
|
-
*/
|
|
129
|
-
/**
|
|
130
|
-
* Parse Base16 YAML into a Base16Scheme object.
|
|
131
|
-
* Handles both quoted and unquoted values, comments, and blank lines.
|
|
132
|
-
*/
|
|
133
|
-
function parseBase16Yaml(yaml) {
|
|
134
|
-
const result = {};
|
|
135
|
-
for (const raw of yaml.split("\n")) {
|
|
136
|
-
const line = raw.trim();
|
|
137
|
-
if (!line || line.startsWith("#")) continue;
|
|
138
|
-
const colonIdx = line.indexOf(":");
|
|
139
|
-
if (colonIdx === -1) continue;
|
|
140
|
-
const key = line.slice(0, colonIdx).trim();
|
|
141
|
-
let value = line.slice(colonIdx + 1).trim();
|
|
142
|
-
if (value.startsWith("\"") && value.endsWith("\"") || value.startsWith("'") && value.endsWith("'")) value = value.slice(1, -1);
|
|
143
|
-
const commentIdx = value.indexOf("#");
|
|
144
|
-
if (commentIdx > 0) value = value.slice(0, commentIdx).trim();
|
|
145
|
-
result[key] = value;
|
|
146
|
-
}
|
|
147
|
-
if (!result.scheme) throw new Error("Base16 YAML missing required field: scheme");
|
|
148
|
-
for (const key of BASE16_KEYS) {
|
|
149
|
-
if (!result[key]) throw new Error(`Base16 YAML missing required color: ${key}`);
|
|
150
|
-
if (!/^[0-9a-fA-F]{6}$/.test(result[key])) throw new Error(`Base16 color ${key} must be a 6-digit hex string without '#', got: "${result[key]}"`);
|
|
151
|
-
}
|
|
152
|
-
return result;
|
|
153
|
-
}
|
|
154
|
-
/** Compute relative luminance (WCAG 2.0) from a hex color with `#` prefix. */
|
|
155
|
-
function luminance(hex) {
|
|
156
|
-
const rgb = hexToRgb(hex);
|
|
157
|
-
if (!rgb) return 0;
|
|
158
|
-
const [r, g, b] = rgb.map((c) => {
|
|
159
|
-
const s = c / 255;
|
|
160
|
-
return s <= .03928 ? s / 12.92 : Math.pow((s + .055) / 1.055, 2.4);
|
|
161
|
-
});
|
|
162
|
-
return .2126 * r + .7152 * g + .0722 * b;
|
|
163
|
-
}
|
|
164
|
-
/** Normalize a bare hex string to `#RRGGBB` (uppercase). */
|
|
165
|
-
function hex(bare) {
|
|
166
|
-
return `#${bare.toUpperCase()}`;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Import a Base16 YAML (or JSON) scheme into a ColorScheme.
|
|
170
|
-
*
|
|
171
|
-
* Mapping:
|
|
172
|
-
* base00 → background, base01 → brightBlack, base02 → selectionBackground,
|
|
173
|
-
* base03 → white (muted fg), base05 → foreground/brightWhite,
|
|
174
|
-
* base08 → red, base09 → brightRed, base0A → yellow,
|
|
175
|
-
* base0B → green, base0C → cyan, base0D → blue, base0E → magenta,
|
|
176
|
-
* base0F → brightMagenta.
|
|
177
|
-
*
|
|
178
|
-
* Bright color variants are derived by brightening normals.
|
|
179
|
-
* `dark` is inferred from base00 luminance.
|
|
180
|
-
*/
|
|
181
|
-
function importBase16(yamlOrJson) {
|
|
182
|
-
return base16ToColorScheme(parseBase16Yaml(yamlOrJson));
|
|
183
|
-
}
|
|
184
|
-
/** Convert a parsed Base16Scheme to ColorScheme. */
|
|
185
|
-
function base16ToColorScheme(scheme) {
|
|
186
|
-
const bg = hex(scheme.base00);
|
|
187
|
-
const fg = hex(scheme.base05);
|
|
188
|
-
const isDark = luminance(bg) < .179;
|
|
189
|
-
const black = isDark ? darken(bg, .15) : brighten(bg, .15);
|
|
190
|
-
const red = hex(scheme.base08);
|
|
191
|
-
const green = hex(scheme.base0B);
|
|
192
|
-
const yellow = hex(scheme.base0A);
|
|
193
|
-
const blue = hex(scheme.base0D);
|
|
194
|
-
const magenta = hex(scheme.base0E);
|
|
195
|
-
const cyan = hex(scheme.base0C);
|
|
196
|
-
return {
|
|
197
|
-
name: scheme.scheme,
|
|
198
|
-
dark: isDark,
|
|
199
|
-
black,
|
|
200
|
-
red,
|
|
201
|
-
green,
|
|
202
|
-
yellow,
|
|
203
|
-
blue,
|
|
204
|
-
magenta,
|
|
205
|
-
cyan,
|
|
206
|
-
white: hex(scheme.base03),
|
|
207
|
-
brightBlack: hex(scheme.base01),
|
|
208
|
-
brightRed: hex(scheme.base09),
|
|
209
|
-
brightGreen: brighten(green, .15),
|
|
210
|
-
brightYellow: brighten(yellow, .15),
|
|
211
|
-
brightBlue: brighten(blue, .15),
|
|
212
|
-
brightMagenta: hex(scheme.base0F),
|
|
213
|
-
brightCyan: brighten(cyan, .15),
|
|
214
|
-
brightWhite: fg,
|
|
215
|
-
foreground: fg,
|
|
216
|
-
background: bg,
|
|
217
|
-
cursorColor: fg,
|
|
218
|
-
cursorText: bg,
|
|
219
|
-
selectionBackground: hex(scheme.base02),
|
|
220
|
-
selectionForeground: fg
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
//#endregion
|
|
224
|
-
//#region packages/theme/src/sterling/contrast.ts
|
|
225
|
-
/**
|
|
226
|
-
* Sterling contrast guardrails — D3 from sterling-preflight.md.
|
|
227
|
-
*
|
|
228
|
-
* Two modes:
|
|
229
|
-
* - `strict` — throw when a core role pair fails WCAG AA 4.5:1.
|
|
230
|
-
* Used by the catalog test (all 84 shipped schemes must pass).
|
|
231
|
-
* - `auto-lift` — adjust OKLCH lightness until AA passes (±0.04L increments
|
|
232
|
-
* up to ~0.20L). Logs at debug; silent by default. Used for user schemes
|
|
233
|
-
* at runtime.
|
|
234
|
-
*
|
|
235
|
-
* Pinned tokens (per-role overrides supplied by scheme authors) are excluded
|
|
236
|
-
* from auto-lift and from strict-mode enforcement — the author accepts the
|
|
237
|
-
* contrast consequence of pinning.
|
|
238
|
-
*/
|
|
239
|
-
/** WCAG AA threshold for normal text. */
|
|
240
|
-
const WCAG_AA = 4.5;
|
|
241
|
-
var ContrastError = class extends Error {
|
|
242
|
-
violations;
|
|
243
|
-
constructor(violations) {
|
|
244
|
-
const summary = violations.slice(0, 5).map((v) => `${v.token}: ${v.ratio.toFixed(2)} < ${v.target} (fg=${v.fg}, bg=${v.bg})`).join("; ");
|
|
245
|
-
const extra = violations.length > 5 ? ` (+${violations.length - 5} more)` : "";
|
|
246
|
-
super(`Sterling contrast: ${violations.length} violation(s): ${summary}${extra}`);
|
|
247
|
-
this.name = "ContrastError";
|
|
248
|
-
this.violations = violations;
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
/**
|
|
252
|
-
* Verify `fg` on `bg` meets `target` ratio. Returns `null` when already
|
|
253
|
-
* passing; otherwise returns a ContrastViolation.
|
|
254
|
-
*/
|
|
255
|
-
function checkAA(token, fg, bg, target = WCAG_AA) {
|
|
256
|
-
const r = checkContrast(fg, bg);
|
|
257
|
-
if (!r) return null;
|
|
258
|
-
if (r.ratio >= target) return null;
|
|
259
|
-
return {
|
|
260
|
-
token,
|
|
261
|
-
fg,
|
|
262
|
-
bg,
|
|
263
|
-
ratio: r.ratio,
|
|
264
|
-
target
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Auto-lift `fg` against `bg` until the `target` contrast ratio is met,
|
|
269
|
-
* via OKLCH L shifts (hue + chroma preserved). Light bg → darken;
|
|
270
|
-
* dark bg → lighten.
|
|
271
|
-
*
|
|
272
|
-
* Implementation note: binary-searches the minimum L shift achieving the
|
|
273
|
-
* target. Falls back to a best-effort value if the target is unreachable
|
|
274
|
-
* (e.g., yellow against white can never hit 4.5:1 at any lightness while
|
|
275
|
-
* preserving yellow hue; the result is the darkest in-gamut yellow).
|
|
276
|
-
*/
|
|
277
|
-
function autoLift(fg, bg, target = WCAG_AA) {
|
|
278
|
-
const current = checkContrast(fg, bg);
|
|
279
|
-
if (!current) return {
|
|
280
|
-
value: fg,
|
|
281
|
-
lifted: false
|
|
282
|
-
};
|
|
283
|
-
if (current.ratio >= target) return {
|
|
284
|
-
value: fg,
|
|
285
|
-
lifted: false
|
|
286
|
-
};
|
|
287
|
-
const adjusted = ensureContrast(fg, bg, target);
|
|
288
|
-
return {
|
|
289
|
-
value: adjusted,
|
|
290
|
-
lifted: adjusted !== fg
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
//#endregion
|
|
294
|
-
//#region packages/theme/src/sterling/derive.ts
|
|
295
|
-
/**
|
|
296
|
-
* Sterling derivation — preservative OKLCH rules over a 22-color ColorScheme.
|
|
297
|
-
*
|
|
298
|
-
* Implements design-system.md §"Derivation rules" with guardrails from D3.
|
|
299
|
-
* Produces the nested `Roles` shape. `flatten.ts` projects the flat keys.
|
|
300
|
-
*
|
|
301
|
-
* Derivation is:
|
|
302
|
-
* 1. `scheme.primary` (or fallback) → accent.fg / accent.bg / info.fg
|
|
303
|
-
* 2. status roles from `scheme.red / yellow / green / primary`
|
|
304
|
-
* 3. Adaptive OKLCH hover/active L-shift (direction = base-L, not scheme.dark):
|
|
305
|
-
* baseL > 0.6 → darken (hover −0.04L, active −0.08L)
|
|
306
|
-
* baseL ≤ 0.6 → brighten (hover +0.04L, active +0.08L)
|
|
307
|
-
* At L extremes (target L > 0.9 or < 0.1) chroma is proportionally
|
|
308
|
-
* reduced so the color pushes toward gray instead of collapsing to
|
|
309
|
-
* white/black — fixes the Frappe yellow/light-accent whiteout.
|
|
310
|
-
* 4. `fgOn` picked for WCAG AA against role's `bg` (prefers scheme bg/fg)
|
|
311
|
-
* 5. surface ramp via OKLCH blend
|
|
312
|
-
* 6. contrast guardrail: strict throws, auto-lift adjusts
|
|
313
|
-
*
|
|
314
|
-
* Per-hue delta adaptation: yellows (H ∈ [80, 110]) get ±0.06L / ±0.10L,
|
|
315
|
-
* low-chroma schemes (C < 0.05) get ±0.06L / ±0.10L. Everything else uses
|
|
316
|
-
* the standard ±0.04L / ±0.08L.
|
|
317
|
-
*
|
|
318
|
-
* Pinned tokens (via `DeriveOptions.pins`) bypass both the rule and
|
|
319
|
-
* auto-lift; they're written verbatim onto the Theme.
|
|
320
|
-
*/
|
|
321
|
-
/**
|
|
322
|
-
* Default typography variants — token-based, works across any Sterling theme.
|
|
323
|
-
* Consumed by `<Text variant="h1">` via the theme's `variants` record.
|
|
324
|
-
*
|
|
325
|
-
* Keys use Sterling flat-token names in their color slots (`$fg-accent`,
|
|
326
|
-
* `$fg-muted`, `$bg-muted`) so the defaults resolve against every Sterling-
|
|
327
|
-
* derived Theme without further wiring.
|
|
328
|
-
*/
|
|
329
|
-
const DEFAULT_VARIANTS = {
|
|
330
|
-
h1: {
|
|
331
|
-
color: "$fg-accent",
|
|
332
|
-
bold: true
|
|
333
|
-
},
|
|
334
|
-
h2: {
|
|
335
|
-
color: "$fg-accent",
|
|
336
|
-
bold: true
|
|
337
|
-
},
|
|
338
|
-
h3: { bold: true },
|
|
339
|
-
body: {},
|
|
340
|
-
"body-muted": { color: "$fg-muted" },
|
|
341
|
-
"fine-print": {
|
|
342
|
-
color: "$fg-muted",
|
|
343
|
-
dim: true
|
|
344
|
-
},
|
|
345
|
-
strong: { bold: true },
|
|
346
|
-
em: { italic: true },
|
|
347
|
-
link: {
|
|
348
|
-
color: "$fg-accent",
|
|
349
|
-
underlineStyle: "single"
|
|
350
|
-
},
|
|
351
|
-
key: {
|
|
352
|
-
color: "$fg-accent",
|
|
353
|
-
bold: true
|
|
354
|
-
},
|
|
355
|
-
code: { backgroundColor: "$bg-muted" },
|
|
356
|
-
kbd: {
|
|
357
|
-
backgroundColor: "$bg-muted",
|
|
358
|
-
color: "$fg-accent",
|
|
359
|
-
bold: true
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
/**
|
|
363
|
-
* Build the 16-slot ANSI palette from a ColorScheme. Indexed `$color0` …
|
|
364
|
-
* `$color15` by the framework's token resolver.
|
|
365
|
-
*/
|
|
366
|
-
function buildPalette(scheme) {
|
|
367
|
-
return [
|
|
368
|
-
scheme.black,
|
|
369
|
-
scheme.red,
|
|
370
|
-
scheme.green,
|
|
371
|
-
scheme.yellow,
|
|
372
|
-
scheme.blue,
|
|
373
|
-
scheme.magenta,
|
|
374
|
-
scheme.cyan,
|
|
375
|
-
scheme.white,
|
|
376
|
-
scheme.brightBlack,
|
|
377
|
-
scheme.brightRed,
|
|
378
|
-
scheme.brightGreen,
|
|
379
|
-
scheme.brightYellow,
|
|
380
|
-
scheme.brightBlue,
|
|
381
|
-
scheme.brightMagenta,
|
|
382
|
-
scheme.brightCyan,
|
|
383
|
-
scheme.brightWhite
|
|
384
|
-
];
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Derive the 8-hue categorical ring from a ColorScheme. Mirrors the legacy
|
|
388
|
-
* derive.ts logic — blends scheme hues for the missing Sterling slots
|
|
389
|
-
* (orange from red+yellow, teal from green+cyan, pink from magenta+red).
|
|
390
|
-
*/
|
|
391
|
-
function buildCategoricalHues(scheme) {
|
|
392
|
-
const dark = scheme.dark ?? true;
|
|
393
|
-
return {
|
|
394
|
-
red: scheme.red,
|
|
395
|
-
orange: blend(scheme.red, scheme.yellow, .5),
|
|
396
|
-
yellow: scheme.yellow,
|
|
397
|
-
green: scheme.green,
|
|
398
|
-
teal: blend(scheme.green, scheme.cyan, .5),
|
|
399
|
-
blue: dark ? scheme.brightBlue : scheme.blue,
|
|
400
|
-
purple: scheme.magenta,
|
|
401
|
-
pink: blend(scheme.magenta, scheme.red, .5)
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
function isYellowish(hex) {
|
|
405
|
-
const o = hexToOklch(hex);
|
|
406
|
-
if (!o) return false;
|
|
407
|
-
return o.H >= 80 && o.H <= 120;
|
|
408
|
-
}
|
|
409
|
-
function isLowChroma(hex) {
|
|
410
|
-
const o = hexToOklch(hex);
|
|
411
|
-
if (!o) return false;
|
|
412
|
-
return o.C < .05;
|
|
413
|
-
}
|
|
414
|
-
/** Compute state-shift deltas for a given base color. Wider for yellows + low-chroma. */
|
|
415
|
-
function stateDeltas(base) {
|
|
416
|
-
if (isYellowish(base) || isLowChroma(base)) return {
|
|
417
|
-
hover: .06,
|
|
418
|
-
active: .1
|
|
419
|
-
};
|
|
420
|
-
return {
|
|
421
|
-
hover: .04,
|
|
422
|
-
active: .08
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
/**
|
|
426
|
-
* Adaptive L-shift: direction follows the token's own luminance, NOT
|
|
427
|
-
* scheme.dark. High-L tokens (yellows, light accents) darken; low-L tokens
|
|
428
|
-
* brighten. Uniform handling — yields a reliable "more active than hover"
|
|
429
|
-
* relationship no matter what hue/lightness the base is.
|
|
430
|
-
*
|
|
431
|
-
* Chroma preservation at L extremes: when the target L pushes past 0.9
|
|
432
|
-
* (approaching white) or below 0.1 (approaching black), chroma is scaled
|
|
433
|
-
* down proportionally so the color drifts toward gray rather than
|
|
434
|
-
* collapsing to #FFFFFF or #000000. This preserves perceptual differences
|
|
435
|
-
* between the base / hover / active states even on intrinsically-bright
|
|
436
|
-
* tokens (catppuccin-frappe yellow, light blue accents, etc.).
|
|
437
|
-
*
|
|
438
|
-
* Returns the original hex unchanged when OKLCH parsing fails.
|
|
439
|
-
*/
|
|
440
|
-
function shiftL(hex, amount) {
|
|
441
|
-
const o = hexToOklch(hex);
|
|
442
|
-
if (!o) return hex;
|
|
443
|
-
const direction = o.L > .6 ? -1 : 1;
|
|
444
|
-
const targetL = clamp01(o.L + direction * amount);
|
|
445
|
-
let nextC = o.C;
|
|
446
|
-
if (targetL > .9 || targetL < .1) {
|
|
447
|
-
const factor = clamp01(1 - Math.abs(targetL - .5) * 2);
|
|
448
|
-
nextC = o.C * factor;
|
|
449
|
-
}
|
|
450
|
-
return oklchToHex({
|
|
451
|
-
L: targetL,
|
|
452
|
-
C: nextC,
|
|
453
|
-
H: o.H
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
function clamp01(x) {
|
|
457
|
-
return x < 0 ? 0 : x > 1 ? 1 : x;
|
|
458
|
-
}
|
|
459
|
-
/** Label the direction the adaptive L-shift took, for trace rule strings. */
|
|
460
|
-
function shiftLabel(hex) {
|
|
461
|
-
const o = hexToOklch(hex);
|
|
462
|
-
if (!o) return "brighten";
|
|
463
|
-
return o.L > .6 ? "darken" : "brighten";
|
|
464
|
-
}
|
|
465
|
-
function inferMode(scheme, explicit) {
|
|
466
|
-
if (explicit) return explicit;
|
|
467
|
-
if (typeof scheme.dark === "boolean") return scheme.dark ? "dark" : "light";
|
|
468
|
-
const lum = relativeLuminance(scheme.background);
|
|
469
|
-
return lum !== null && lum < .5 ? "dark" : "light";
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Pick a foreground color to draw on a filled `bg` of a role. Prefers
|
|
473
|
-
* `scheme.background` if it beats AA against the role bg (i.e. the role bg
|
|
474
|
-
* is bright enough that using dark text reads); otherwise `scheme.foreground`;
|
|
475
|
-
* otherwise falls back to white/black by bg luminance.
|
|
476
|
-
*/
|
|
477
|
-
function pickFgOn(roleBg, scheme) {
|
|
478
|
-
const candidates = [
|
|
479
|
-
scheme.foreground,
|
|
480
|
-
scheme.background,
|
|
481
|
-
"#FFFFFF",
|
|
482
|
-
"#000000"
|
|
483
|
-
];
|
|
484
|
-
let best = candidates[0];
|
|
485
|
-
let bestRatio = 0;
|
|
486
|
-
for (const c of candidates) {
|
|
487
|
-
const r = checkAA("fgOn", c, roleBg);
|
|
488
|
-
if (r === null) return c;
|
|
489
|
-
if (r.ratio > bestRatio) {
|
|
490
|
-
best = c;
|
|
491
|
-
bestRatio = r.ratio;
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
return best;
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Resolve a pin for a token path. Accepts both nested (`"accent.hover.bg"`)
|
|
498
|
-
* and flat (`"bg-accent-hover"`) forms. Returns the pinned hex or undefined.
|
|
499
|
-
*/
|
|
500
|
-
function pin(pins, nested, flat) {
|
|
501
|
-
if (!pins) return void 0;
|
|
502
|
-
return pins[nested] ?? pins[flat];
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* Shared guard: handles pin → rule → contrast check → auto-lift → record.
|
|
506
|
-
* `target` defaults to WCAG_AA (4.5); callers use 3.0 for "muted" tokens
|
|
507
|
-
* that are deemphasized by design.
|
|
508
|
-
*/
|
|
509
|
-
function guardTarget(nestedPath, flatPath, rule, inputs, value, against, target, contrast, pins, trace, violations) {
|
|
510
|
-
const pinned = pin(pins, nestedPath, flatPath);
|
|
511
|
-
if (pinned !== void 0) {
|
|
512
|
-
trace.push({
|
|
513
|
-
token: nestedPath,
|
|
514
|
-
rule: "pinned by scheme author",
|
|
515
|
-
inputs: [pinned],
|
|
516
|
-
output: pinned,
|
|
517
|
-
pinned: true
|
|
518
|
-
});
|
|
519
|
-
return pinned;
|
|
520
|
-
}
|
|
521
|
-
if (against === void 0) {
|
|
522
|
-
trace.push({
|
|
523
|
-
token: nestedPath,
|
|
524
|
-
rule,
|
|
525
|
-
inputs,
|
|
526
|
-
output: value
|
|
527
|
-
});
|
|
528
|
-
return value;
|
|
529
|
-
}
|
|
530
|
-
if (checkAA(nestedPath, value, against, target) === null) {
|
|
531
|
-
trace.push({
|
|
532
|
-
token: nestedPath,
|
|
533
|
-
rule,
|
|
534
|
-
inputs,
|
|
535
|
-
output: value
|
|
536
|
-
});
|
|
537
|
-
return value;
|
|
538
|
-
}
|
|
539
|
-
const lifted = autoLift(value, against, target);
|
|
540
|
-
const finalValue = lifted.value;
|
|
541
|
-
const residual = checkAA(nestedPath, finalValue, against, target);
|
|
542
|
-
if (residual !== null) violations.push(residual);
|
|
543
|
-
trace.push({
|
|
544
|
-
token: nestedPath,
|
|
545
|
-
rule: lifted.lifted ? `${rule} + auto-lift` : rule,
|
|
546
|
-
inputs,
|
|
547
|
-
output: finalValue,
|
|
548
|
-
...lifted.lifted ? { liftedFrom: value } : {}
|
|
549
|
-
});
|
|
550
|
-
return finalValue;
|
|
551
|
-
}
|
|
552
|
-
/**
|
|
553
|
-
* Derive a Theme's nested roles from a ColorScheme. Guardrails applied.
|
|
554
|
-
*/
|
|
555
|
-
function deriveRoles(scheme, opts) {
|
|
556
|
-
const mode = inferMode(scheme, opts.mode);
|
|
557
|
-
const contrast = opts.contrast ?? "auto-lift";
|
|
558
|
-
const pins = opts.pins;
|
|
559
|
-
const trace = [];
|
|
560
|
-
const violations = [];
|
|
561
|
-
const primary = scheme.primary ?? (mode === "dark" ? scheme.brightBlue : scheme.blue);
|
|
562
|
-
const bg = scheme.background;
|
|
563
|
-
const fg = scheme.foreground;
|
|
564
|
-
function guard(nestedPath, flatPath, rule, inputs, value, against, target = WCAG_AA) {
|
|
565
|
-
return guardTarget(nestedPath, flatPath, rule, inputs, value, against, target, contrast, pins, trace, violations);
|
|
566
|
-
}
|
|
567
|
-
const accentBase = guard("accent.fg", "fg-accent", "scheme.primary", [primary], primary, bg);
|
|
568
|
-
const accentBg = guard("accent.bg", "bg-accent", "scheme.primary", [primary], primary);
|
|
569
|
-
const deltaA = stateDeltas(accentBg);
|
|
570
|
-
const bgDir = shiftLabel(accentBg);
|
|
571
|
-
const accentHoverBg = guard("accent.hover.bg", "bg-accent-hover", `OKLCH ${bgDir} ${deltaA.hover}L on accent.bg`, [accentBg], shiftL(accentBg, deltaA.hover));
|
|
572
|
-
const accentActiveBg = guard("accent.active.bg", "bg-accent-active", `OKLCH ${bgDir} ${deltaA.active}L on accent.bg`, [accentBg], shiftL(accentBg, deltaA.active));
|
|
573
|
-
const accentFgOn = guard("accent.fgOn", "fg-on-accent", "contrast-pick(scheme.fg/bg/BW)", [accentBg], pickFgOn(accentBg, scheme), accentBg);
|
|
574
|
-
const accentBorder = guard("accent.border", "border-accent", "= accent.bg", [accentBg], accentBg);
|
|
575
|
-
const fgDir = shiftLabel(accentBase);
|
|
576
|
-
const accentHoverFg = guard("accent.hover.fg", "fg-accent-hover", `OKLCH ${fgDir} ${deltaA.hover}L on accent.fg`, [accentBase], shiftL(accentBase, deltaA.hover), bg);
|
|
577
|
-
const accentActiveFg = guard("accent.active.fg", "fg-accent-active", `OKLCH ${fgDir} ${deltaA.active}L on accent.fg`, [accentBase], shiftL(accentBase, deltaA.active), bg);
|
|
578
|
-
return {
|
|
579
|
-
roles: {
|
|
580
|
-
accent: {
|
|
581
|
-
fg: accentBase,
|
|
582
|
-
bg: accentBg,
|
|
583
|
-
fgOn: accentFgOn,
|
|
584
|
-
border: accentBorder,
|
|
585
|
-
hover: {
|
|
586
|
-
fg: accentHoverFg,
|
|
587
|
-
bg: accentHoverBg
|
|
588
|
-
},
|
|
589
|
-
active: {
|
|
590
|
-
fg: accentActiveFg,
|
|
591
|
-
bg: accentActiveBg
|
|
592
|
-
}
|
|
593
|
-
},
|
|
594
|
-
info: buildInteractive("info", primary, scheme, opts, trace, violations),
|
|
595
|
-
success: buildInteractive("success", scheme.green, scheme, opts, trace, violations),
|
|
596
|
-
warning: buildInteractive("warning", scheme.yellow, scheme, opts, trace, violations),
|
|
597
|
-
error: buildInteractive("error", scheme.red, scheme, opts, trace, violations),
|
|
598
|
-
muted: {
|
|
599
|
-
fg: guard("muted.fg", "fg-muted", "blend(fg, bg, 0.4)", [fg, bg], blend(fg, bg, .4), bg, 3),
|
|
600
|
-
bg: guard("muted.bg", "bg-muted", "blend(bg, fg, 0.08)", [bg, fg], blend(bg, fg, .08))
|
|
601
|
-
},
|
|
602
|
-
surface: {
|
|
603
|
-
default: guard("surface.default", "bg-surface-default", "scheme.background", [bg], bg),
|
|
604
|
-
subtle: guard("surface.subtle", "bg-surface-subtle", "blend(bg, fg, 0.05)", [bg, fg], blend(bg, fg, .05)),
|
|
605
|
-
raised: guard("surface.raised", "bg-surface-raised", "blend(bg, fg, 0.08)", [bg, fg], blend(bg, fg, .08)),
|
|
606
|
-
overlay: guard("surface.overlay", "bg-surface-overlay", "blend(bg, fg, 0.12)", [bg, fg], blend(bg, fg, .12)),
|
|
607
|
-
hover: guard("surface.hover", "bg-surface-hover", "blend(bg, fg, 0.10)", [bg, fg], blend(bg, fg, .1))
|
|
608
|
-
},
|
|
609
|
-
border: {
|
|
610
|
-
default: guard("border.default", "border-default", "blend(bg, fg, 0.18)", [bg, fg], blend(bg, fg, .18)),
|
|
611
|
-
focus: guard("border.focus", "border-focus", "= accent.bg", [accentBg], accentBg, bg),
|
|
612
|
-
muted: guard("border.muted", "border-muted", "blend(bg, fg, 0.10)", [bg, fg], blend(bg, fg, .1))
|
|
613
|
-
},
|
|
614
|
-
cursor: {
|
|
615
|
-
fg: guard("cursor.fg", "fg-cursor", "scheme.cursorText", [scheme.cursorText], scheme.cursorText),
|
|
616
|
-
bg: guard("cursor.bg", "bg-cursor", "scheme.cursorColor", [scheme.cursorColor], scheme.cursorColor)
|
|
617
|
-
}
|
|
618
|
-
},
|
|
619
|
-
mode,
|
|
620
|
-
trace,
|
|
621
|
-
violations
|
|
622
|
-
};
|
|
623
|
-
}
|
|
624
|
-
function buildInteractive(name, seed, scheme, opts, trace, violations) {
|
|
625
|
-
const pins = opts.pins;
|
|
626
|
-
const contrast = opts.contrast ?? "auto-lift";
|
|
627
|
-
const bg = scheme.background;
|
|
628
|
-
const guard = (nestedPath, flatPath, rule, inputs, value, against, target = WCAG_AA) => guardTarget(nestedPath, flatPath, rule, inputs, value, against, target, contrast, pins, trace, violations);
|
|
629
|
-
const fg = guard(`${name}.fg`, `fg-${name}`, seedRule(name), [seed], seed, bg);
|
|
630
|
-
const roleBg = guard(`${name}.bg`, `bg-${name}`, seedRule(name), [seed], seed);
|
|
631
|
-
const delta = stateDeltas(roleBg);
|
|
632
|
-
const bgDir = shiftLabel(roleBg);
|
|
633
|
-
const fgOn = guard(`${name}.fgOn`, `fg-on-${name}`, "contrast-pick(scheme.fg/bg/BW)", [roleBg], pickFgOn(roleBg, scheme), roleBg);
|
|
634
|
-
const hoverBg = guard(`${name}.hover.bg`, `bg-${name}-hover`, `OKLCH ${bgDir} ${delta.hover}L`, [roleBg], shiftL(roleBg, delta.hover));
|
|
635
|
-
const activeBg = guard(`${name}.active.bg`, `bg-${name}-active`, `OKLCH ${bgDir} ${delta.active}L`, [roleBg], shiftL(roleBg, delta.active));
|
|
636
|
-
return {
|
|
637
|
-
fg,
|
|
638
|
-
bg: roleBg,
|
|
639
|
-
fgOn,
|
|
640
|
-
hover: { bg: hoverBg },
|
|
641
|
-
active: { bg: activeBg }
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
|
-
function seedRule(name) {
|
|
645
|
-
switch (name) {
|
|
646
|
-
case "info": return "scheme.primary (info mirrors accent's seed, derived independently)";
|
|
647
|
-
case "success": return "scheme.green";
|
|
648
|
-
case "warning": return "scheme.yellow";
|
|
649
|
-
case "error": return "scheme.red";
|
|
650
|
-
case "accent": return "scheme.primary";
|
|
651
|
-
default: return `scheme.${name}`;
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
/**
|
|
655
|
-
* Derive a full Theme (pre-flatten) from a ColorScheme. Throws `ContrastError`
|
|
656
|
-
* in strict mode if any role pair fails WCAG AA. Callers typically wrap this
|
|
657
|
-
* with `flatten()` (from `flatten.ts`) to get the user-facing Theme.
|
|
658
|
-
*
|
|
659
|
-
* Returned Theme is NOT frozen and DOES NOT contain flat keys yet.
|
|
660
|
-
*/
|
|
661
|
-
function deriveTheme(scheme, opts = {}) {
|
|
662
|
-
const { roles, mode, trace, violations } = deriveRoles(scheme, opts);
|
|
663
|
-
if ((opts.contrast ?? "auto-lift") === "strict" && violations.length > 0) throw new ContrastError(violations);
|
|
664
|
-
return {
|
|
665
|
-
...roles,
|
|
666
|
-
...buildCategoricalHues(scheme),
|
|
667
|
-
name: scheme.name,
|
|
668
|
-
mode,
|
|
669
|
-
variants: DEFAULT_VARIANTS,
|
|
670
|
-
palette: buildPalette(scheme),
|
|
671
|
-
...opts.trace ? { derivationTrace: trace } : {}
|
|
672
|
-
};
|
|
673
|
-
}
|
|
674
|
-
/**
|
|
675
|
-
* Merge a DeepPartial<Theme> onto an existing Theme (for `sterling.theme()`).
|
|
676
|
-
* Nested role objects are spread deeply; flat keys are replaced if present.
|
|
677
|
-
*/
|
|
678
|
-
function mergePartial(base, patch) {
|
|
679
|
-
if (!patch) return base;
|
|
680
|
-
const out = { ...base };
|
|
681
|
-
for (const [k, v] of Object.entries(patch)) {
|
|
682
|
-
if (v === void 0) continue;
|
|
683
|
-
const cur = base[k];
|
|
684
|
-
if (cur && typeof cur === "object" && typeof v === "object" && !Array.isArray(v)) {
|
|
685
|
-
out[k] = {
|
|
686
|
-
...cur,
|
|
687
|
-
...v
|
|
688
|
-
};
|
|
689
|
-
for (const [k2, v2] of Object.entries(v)) if (v2 && typeof v2 === "object" && !Array.isArray(v2) && cur[k2] && typeof cur[k2] === "object") out[k][k2] = {
|
|
690
|
-
...cur[k2],
|
|
691
|
-
...v2
|
|
692
|
-
};
|
|
693
|
-
} else out[k] = v;
|
|
694
|
-
}
|
|
695
|
-
return out;
|
|
696
|
-
}
|
|
697
|
-
//#endregion
|
|
698
|
-
//#region packages/theme/src/sterling/inline.ts
|
|
699
|
-
/**
|
|
700
|
-
* Build a ColorScheme-shaped input from a legacy Theme when the original
|
|
701
|
-
* scheme isn't available (hand-crafted themes, picker round-trips).
|
|
702
|
-
*/
|
|
703
|
-
function schemeFromLegacy(theme) {
|
|
704
|
-
const palette = theme.palette ?? [];
|
|
705
|
-
return {
|
|
706
|
-
name: theme.name,
|
|
707
|
-
dark: isDark(theme.bg),
|
|
708
|
-
primary: theme.primary,
|
|
709
|
-
black: palette[0] ?? "#000000",
|
|
710
|
-
red: palette[1] ?? theme.error,
|
|
711
|
-
green: palette[2] ?? theme.success,
|
|
712
|
-
yellow: palette[3] ?? theme.warning,
|
|
713
|
-
blue: palette[4] ?? theme.primary,
|
|
714
|
-
magenta: palette[5] ?? theme.accent,
|
|
715
|
-
cyan: palette[6] ?? theme.info,
|
|
716
|
-
white: palette[7] ?? theme.fg,
|
|
717
|
-
brightBlack: palette[8] ?? theme.muted,
|
|
718
|
-
brightRed: palette[9] ?? theme.error,
|
|
719
|
-
brightGreen: palette[10] ?? theme.success,
|
|
720
|
-
brightYellow: palette[11] ?? theme.warning,
|
|
721
|
-
brightBlue: palette[12] ?? theme.primary,
|
|
722
|
-
brightMagenta: palette[13] ?? theme.accent,
|
|
723
|
-
brightCyan: palette[14] ?? theme.info,
|
|
724
|
-
brightWhite: palette[15] ?? theme.fg,
|
|
725
|
-
foreground: theme.fg,
|
|
726
|
-
background: theme.bg,
|
|
727
|
-
cursorColor: theme.cursorbg,
|
|
728
|
-
cursorText: theme.cursor,
|
|
729
|
-
selectionBackground: theme.selectionbg,
|
|
730
|
-
selectionForeground: theme.selection
|
|
731
|
-
};
|
|
732
|
-
}
|
|
733
|
-
/**
|
|
734
|
-
* Quick luminance check — matches relativeLuminance threshold (0.5). Avoids
|
|
735
|
-
* pulling in @silvery/color for a single boolean.
|
|
736
|
-
*/
|
|
737
|
-
function isDark(hex) {
|
|
738
|
-
const m = /^#?([0-9a-f]{6})$/i.exec(hex);
|
|
739
|
-
if (!m?.[1]) return true;
|
|
740
|
-
const n = parseInt(m[1], 16);
|
|
741
|
-
const r = n >> 16 & 255;
|
|
742
|
-
const g = n >> 8 & 255;
|
|
743
|
-
const b = n & 255;
|
|
744
|
-
return (.2126 * r + .7152 * g + .0722 * b) / 255 < .5;
|
|
745
|
-
}
|
|
746
|
-
/**
|
|
747
|
-
* Write Sterling flat tokens onto a legacy Theme in-place and return the
|
|
748
|
-
* augmented object. Mirrors the old `augmentWithSterlingFlat` semantics:
|
|
749
|
-
* only sets a key if it's not already a string on the theme.
|
|
750
|
-
*
|
|
751
|
-
* When `scheme` is provided, Sterling derives directly from it (full fidelity).
|
|
752
|
-
* Otherwise a scheme is reconstructed from the theme's palette (lossy on ANSI
|
|
753
|
-
* slots but fine for Sterling's derivation surface).
|
|
754
|
-
*/
|
|
755
|
-
function inlineSterlingTokens(theme, scheme) {
|
|
756
|
-
const { roles } = deriveRoles(scheme ?? schemeFromLegacy(theme), { contrast: "auto-lift" });
|
|
757
|
-
const out = { ...theme };
|
|
758
|
-
const setIfAbsent = (key, value) => {
|
|
759
|
-
if (!(key in out) || typeof out[key] !== "string") out[key] = value;
|
|
760
|
-
};
|
|
761
|
-
const accent = roles.accent;
|
|
762
|
-
if (accent) {
|
|
763
|
-
setIfAbsent("fg-accent", accent.fg);
|
|
764
|
-
setIfAbsent("bg-accent", accent.bg);
|
|
765
|
-
setIfAbsent("fg-on-accent", accent.fgOn);
|
|
766
|
-
for (const state of ["hover", "active"]) {
|
|
767
|
-
const s = accent[state];
|
|
768
|
-
if (!s) continue;
|
|
769
|
-
setIfAbsent(`fg-accent-${state}`, s.fg);
|
|
770
|
-
setIfAbsent(`bg-accent-${state}`, s.bg);
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
for (const role of [
|
|
774
|
-
"info",
|
|
775
|
-
"success",
|
|
776
|
-
"warning",
|
|
777
|
-
"error"
|
|
778
|
-
]) {
|
|
779
|
-
const r = roles[role];
|
|
780
|
-
if (!r) continue;
|
|
781
|
-
setIfAbsent(`fg-${role}`, r.fg);
|
|
782
|
-
setIfAbsent(`bg-${role}`, r.bg);
|
|
783
|
-
setIfAbsent(`fg-on-${role}`, r.fgOn);
|
|
784
|
-
for (const state of ["hover", "active"]) {
|
|
785
|
-
const s = r[state];
|
|
786
|
-
if (!s) continue;
|
|
787
|
-
setIfAbsent(`bg-${role}-${state}`, s.bg);
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
if (roles.accent && "border" in roles.accent) setIfAbsent("border-accent", roles.accent.border);
|
|
791
|
-
const surf = roles.surface;
|
|
792
|
-
if (surf) {
|
|
793
|
-
setIfAbsent("bg-surface-default", surf.default);
|
|
794
|
-
setIfAbsent("bg-surface-subtle", surf.subtle);
|
|
795
|
-
setIfAbsent("bg-surface-raised", surf.raised);
|
|
796
|
-
setIfAbsent("bg-surface-overlay", surf.overlay);
|
|
797
|
-
setIfAbsent("bg-surface-hover", surf.hover);
|
|
798
|
-
}
|
|
799
|
-
const b = roles.border;
|
|
800
|
-
if (b) {
|
|
801
|
-
setIfAbsent("border-default", b.default);
|
|
802
|
-
setIfAbsent("border-focus", b.focus);
|
|
803
|
-
setIfAbsent("border-muted", b.muted);
|
|
804
|
-
}
|
|
805
|
-
const c = roles.cursor;
|
|
806
|
-
if (c) {
|
|
807
|
-
setIfAbsent("fg-cursor", c.fg);
|
|
808
|
-
setIfAbsent("bg-cursor", c.bg);
|
|
809
|
-
}
|
|
810
|
-
const m = roles.muted;
|
|
811
|
-
if (m) {
|
|
812
|
-
setIfAbsent("fg-muted", m.fg);
|
|
813
|
-
setIfAbsent("bg-muted", m.bg);
|
|
814
|
-
}
|
|
815
|
-
return out;
|
|
816
|
-
}
|
|
817
|
-
//#endregion
|
|
1
|
+
import { it as deriveTheme, nt as ansi16DarkTheme$1, rt as ansi16LightTheme$1 } from "./src-Oe6x5PrS.mjs";
|
|
2
|
+
import { brighten } from "@silvery/color";
|
|
818
3
|
//#region packages/theme/src/schemes/catppuccin.ts
|
|
819
4
|
/** Catppuccin Mocha — the classic dark variant. */
|
|
820
5
|
const catppuccinMocha = {
|
|
@@ -3186,29 +2371,34 @@ const gnomeTerminalTango = {
|
|
|
3186
2371
|
};
|
|
3187
2372
|
//#endregion
|
|
3188
2373
|
//#region packages/theme/src/schemes/index.ts
|
|
3189
|
-
|
|
2374
|
+
/**
|
|
2375
|
+
* Built-in themes and palette registry.
|
|
2376
|
+
*
|
|
2377
|
+
* Exports:
|
|
2378
|
+
* - Pre-derived Theme objects (ansi16Dark, ansi16Light, defaultDark, defaultLight)
|
|
2379
|
+
* - ColorScheme definitions from popular theme systems (70+ palettes)
|
|
2380
|
+
* - Registry functions (getThemeByName, getSchemeByName)
|
|
2381
|
+
*/
|
|
3190
2382
|
/**
|
|
3191
2383
|
* Dark ANSI 16 theme — hex-valued, derived from the default dark scheme.
|
|
3192
2384
|
* All token values are hex strings (no ANSI slot names).
|
|
3193
|
-
* Terminal rendering quantizes hex to 4-bit ANSI codes when colorLevel === "
|
|
2385
|
+
* Terminal rendering quantizes hex to 4-bit ANSI codes when colorLevel === "ansi16".
|
|
3194
2386
|
*
|
|
3195
2387
|
* Sterling flat tokens (`bg-surface-subtle`, `fg-on-accent`, `border-focus`, …)
|
|
3196
|
-
* are baked in
|
|
3197
|
-
* Sterling flat keys off the same
|
|
2388
|
+
* are baked in by `@silvery/ansi`'s `deriveAnsi16Theme` — consumers read either
|
|
2389
|
+
* legacy fields or Sterling flat keys off the same object.
|
|
3198
2390
|
*/
|
|
3199
|
-
const ansi16DarkTheme =
|
|
2391
|
+
const ansi16DarkTheme = ansi16DarkTheme$1;
|
|
3200
2392
|
/**
|
|
3201
2393
|
* Light ANSI 16 theme — hex-valued, derived from the default light scheme.
|
|
3202
2394
|
* All token values are hex strings (no ANSI slot names).
|
|
3203
|
-
* Terminal rendering quantizes hex to 4-bit ANSI codes when colorLevel === "
|
|
3204
|
-
*
|
|
3205
|
-
* Sterling flat tokens baked in at construction.
|
|
2395
|
+
* Terminal rendering quantizes hex to 4-bit ANSI codes when colorLevel === "ansi16".
|
|
3206
2396
|
*/
|
|
3207
|
-
const ansi16LightTheme =
|
|
3208
|
-
/** Dark truecolor theme — derived from Nord. Sterling flat tokens baked in
|
|
3209
|
-
const defaultDarkTheme =
|
|
3210
|
-
/** Light truecolor theme — derived from Catppuccin Latte. Sterling flat tokens baked in
|
|
3211
|
-
const defaultLightTheme =
|
|
2397
|
+
const ansi16LightTheme = ansi16LightTheme$1;
|
|
2398
|
+
/** Dark truecolor theme — derived from Nord. Sterling flat tokens baked in by `deriveTheme`. */
|
|
2399
|
+
const defaultDarkTheme = deriveTheme(nord);
|
|
2400
|
+
/** Light truecolor theme — derived from Catppuccin Latte. Sterling flat tokens baked in by `deriveTheme`. */
|
|
2401
|
+
const defaultLightTheme = deriveTheme(catppuccinLatte);
|
|
3212
2402
|
/** All built-in ColorScheme definitions (70+ palettes). */
|
|
3213
2403
|
const builtinPalettes = {
|
|
3214
2404
|
"catppuccin-mocha": catppuccinMocha,
|
|
@@ -3313,7 +2503,7 @@ function getThemeByName(name) {
|
|
|
3313
2503
|
const builtin = builtinThemes[name];
|
|
3314
2504
|
if (builtin) return builtin;
|
|
3315
2505
|
const palette = builtinPalettes[name];
|
|
3316
|
-
if (palette) return
|
|
2506
|
+
if (palette) return deriveTheme(palette);
|
|
3317
2507
|
return ansi16DarkTheme;
|
|
3318
2508
|
}
|
|
3319
2509
|
/** Resolve a palette by name. Returns undefined if not found. */
|
|
@@ -3321,985 +2511,6 @@ function getSchemeByName(name) {
|
|
|
3321
2511
|
return builtinPalettes[name];
|
|
3322
2512
|
}
|
|
3323
2513
|
//#endregion
|
|
3324
|
-
|
|
3325
|
-
/**
|
|
3326
|
-
* Palette generators — produce a ColorScheme from various inputs.
|
|
3327
|
-
*
|
|
3328
|
-
* All generators return a complete ColorScheme (22 fields).
|
|
3329
|
-
*/
|
|
3330
|
-
function isDarkColor$1(hex) {
|
|
3331
|
-
const L = relativeLuminance(hex);
|
|
3332
|
-
return L === null ? true : L < .5;
|
|
3333
|
-
}
|
|
3334
|
-
/**
|
|
3335
|
-
* Target hues for each accent slot, in OKLCH degrees.
|
|
3336
|
-
* OKLCH hues differ from HSL — red ≈ 29, green ≈ 142, blue ≈ 264. Calibrated
|
|
3337
|
-
* per Ottosson's reference ramps for perceptually-uniform accent generation.
|
|
3338
|
-
*/
|
|
3339
|
-
const targetHues = {
|
|
3340
|
-
red: 29,
|
|
3341
|
-
orange: 55,
|
|
3342
|
-
yellow: 90,
|
|
3343
|
-
green: 142,
|
|
3344
|
-
teal: 195,
|
|
3345
|
-
blue: 240,
|
|
3346
|
-
purple: 305,
|
|
3347
|
-
pink: 350
|
|
3348
|
-
};
|
|
3349
|
-
/** Find which hue slot the primary color best matches by OKLCH hue angle proximity. */
|
|
3350
|
-
function assignPrimaryToSlot(primary) {
|
|
3351
|
-
const o = hexToOklch(primary);
|
|
3352
|
-
if (!o) return "blue";
|
|
3353
|
-
const h = o.H;
|
|
3354
|
-
for (const [lo, hi, name] of [
|
|
3355
|
-
[
|
|
3356
|
-
0,
|
|
3357
|
-
15,
|
|
3358
|
-
"red"
|
|
3359
|
-
],
|
|
3360
|
-
[
|
|
3361
|
-
15,
|
|
3362
|
-
42,
|
|
3363
|
-
"orange"
|
|
3364
|
-
],
|
|
3365
|
-
[
|
|
3366
|
-
42,
|
|
3367
|
-
75,
|
|
3368
|
-
"yellow"
|
|
3369
|
-
],
|
|
3370
|
-
[
|
|
3371
|
-
75,
|
|
3372
|
-
170,
|
|
3373
|
-
"green"
|
|
3374
|
-
],
|
|
3375
|
-
[
|
|
3376
|
-
170,
|
|
3377
|
-
210,
|
|
3378
|
-
"teal"
|
|
3379
|
-
],
|
|
3380
|
-
[
|
|
3381
|
-
210,
|
|
3382
|
-
275,
|
|
3383
|
-
"blue"
|
|
3384
|
-
],
|
|
3385
|
-
[
|
|
3386
|
-
275,
|
|
3387
|
-
330,
|
|
3388
|
-
"purple"
|
|
3389
|
-
],
|
|
3390
|
-
[
|
|
3391
|
-
330,
|
|
3392
|
-
360,
|
|
3393
|
-
"pink"
|
|
3394
|
-
]
|
|
3395
|
-
]) if (h >= lo && h < hi) return name;
|
|
3396
|
-
return "red";
|
|
3397
|
-
}
|
|
3398
|
-
/** Generate 8 accent hues from a primary, placing it in its natural slot. */
|
|
3399
|
-
function generateAccentsFromPrimary(primary) {
|
|
3400
|
-
const o = hexToOklch(primary);
|
|
3401
|
-
if (!o) return {
|
|
3402
|
-
red: "#BF616A",
|
|
3403
|
-
orange: "#D08770",
|
|
3404
|
-
yellow: "#EBCB8B",
|
|
3405
|
-
green: "#A3BE8C",
|
|
3406
|
-
teal: "#88C0D0",
|
|
3407
|
-
blue: "#5E81AC",
|
|
3408
|
-
purple: "#B48EAD",
|
|
3409
|
-
pink: "#D4879C"
|
|
3410
|
-
};
|
|
3411
|
-
const slot = assignPrimaryToSlot(primary);
|
|
3412
|
-
const result = {};
|
|
3413
|
-
for (const [name, targetH] of Object.entries(targetHues)) result[name] = name === slot ? primary : oklchToHex({
|
|
3414
|
-
L: o.L,
|
|
3415
|
-
C: o.C,
|
|
3416
|
-
H: targetH
|
|
3417
|
-
});
|
|
3418
|
-
return result;
|
|
3419
|
-
}
|
|
3420
|
-
/**
|
|
3421
|
-
* Generate a ColorScheme from a Base16 YAML scheme.
|
|
3422
|
-
*
|
|
3423
|
-
* Maps base00–base0F to ANSI palette colors, derives special colors.
|
|
3424
|
-
*/
|
|
3425
|
-
function fromBase16(yamlOrJson) {
|
|
3426
|
-
return importBase16(yamlOrJson);
|
|
3427
|
-
}
|
|
3428
|
-
/**
|
|
3429
|
-
* Generate a full ColorScheme from 1-3 hex colors.
|
|
3430
|
-
*
|
|
3431
|
-
* At minimum, provide `background` or `primary`. Missing colors are
|
|
3432
|
-
* generated via surface ramp (from bg) and hue rotation (from primary).
|
|
3433
|
-
*/
|
|
3434
|
-
function fromColors(opts) {
|
|
3435
|
-
const dark = opts.dark ?? (opts.background ? isDarkColor$1(opts.background) : true);
|
|
3436
|
-
const step = dark ? brighten : darken;
|
|
3437
|
-
const bg = opts.background ?? (dark ? "#2E3440" : "#FFFFFF");
|
|
3438
|
-
const fg = opts.foreground ?? step(bg, .85);
|
|
3439
|
-
const accents = opts.primary ? generateAccentsFromPrimary(opts.primary) : {
|
|
3440
|
-
red: "#BF616A",
|
|
3441
|
-
orange: "#D08770",
|
|
3442
|
-
yellow: "#EBCB8B",
|
|
3443
|
-
green: "#A3BE8C",
|
|
3444
|
-
teal: "#88C0D0",
|
|
3445
|
-
blue: "#5E81AC",
|
|
3446
|
-
purple: "#B48EAD",
|
|
3447
|
-
pink: "#D4879C"
|
|
3448
|
-
};
|
|
3449
|
-
const black = dark ? darken(bg, .05) : darken(bg, .1);
|
|
3450
|
-
const white = dark ? blend(fg, bg, .3) : blend(bg, fg, .3);
|
|
3451
|
-
const brightBlack = step(bg, .15);
|
|
3452
|
-
const brightWhite = dark ? fg : brighten(fg, .1);
|
|
3453
|
-
return {
|
|
3454
|
-
name: opts.name ?? (dark ? "generated-dark" : "generated-light"),
|
|
3455
|
-
dark,
|
|
3456
|
-
primary: opts.primary,
|
|
3457
|
-
black,
|
|
3458
|
-
red: accents.red,
|
|
3459
|
-
green: accents.green,
|
|
3460
|
-
yellow: accents.yellow,
|
|
3461
|
-
blue: accents.blue,
|
|
3462
|
-
magenta: accents.purple,
|
|
3463
|
-
cyan: accents.teal,
|
|
3464
|
-
white,
|
|
3465
|
-
brightBlack,
|
|
3466
|
-
brightRed: accents.orange,
|
|
3467
|
-
brightGreen: brighten(accents.green, .15),
|
|
3468
|
-
brightYellow: brighten(accents.yellow, .15),
|
|
3469
|
-
brightBlue: brighten(accents.blue, .15),
|
|
3470
|
-
brightMagenta: accents.pink,
|
|
3471
|
-
brightCyan: brighten(accents.teal, .15),
|
|
3472
|
-
brightWhite,
|
|
3473
|
-
foreground: fg,
|
|
3474
|
-
background: bg,
|
|
3475
|
-
cursorColor: fg,
|
|
3476
|
-
cursorText: bg,
|
|
3477
|
-
selectionBackground: blend(bg, accents.blue, .3),
|
|
3478
|
-
selectionForeground: fg
|
|
3479
|
-
};
|
|
3480
|
-
}
|
|
3481
|
-
/**
|
|
3482
|
-
* Look up a built-in palette by name.
|
|
3483
|
-
*
|
|
3484
|
-
* @returns The ColorScheme, or undefined if not found.
|
|
3485
|
-
*/
|
|
3486
|
-
function fromPreset(name) {
|
|
3487
|
-
return getSchemeByName(name);
|
|
3488
|
-
}
|
|
3489
|
-
//#endregion
|
|
3490
|
-
//#region packages/theme/src/builder.ts
|
|
3491
|
-
/**
|
|
3492
|
-
* Chainable theme builder — create themes from minimal input.
|
|
3493
|
-
*
|
|
3494
|
-
* @example
|
|
3495
|
-
* ```typescript
|
|
3496
|
-
* // Just a background color
|
|
3497
|
-
* const theme = createTheme().bg('#2E3440').build()
|
|
3498
|
-
*
|
|
3499
|
-
* // Primary + explicit dark mode
|
|
3500
|
-
* const theme = createTheme().primary('#EBCB8B').dark().build()
|
|
3501
|
-
*
|
|
3502
|
-
* // Three-color input (dark/light inferred from bg luminance)
|
|
3503
|
-
* const theme = createTheme()
|
|
3504
|
-
* .bg('#2E3440').fg('#ECEFF4').primary('#EBCB8B').build()
|
|
3505
|
-
*
|
|
3506
|
-
* // Preset with override
|
|
3507
|
-
* const theme = createTheme().preset('nord').primary('#A3BE8C').build()
|
|
3508
|
-
* ```
|
|
3509
|
-
*/
|
|
3510
|
-
init_src();
|
|
3511
|
-
function isDarkColor(hex) {
|
|
3512
|
-
const rgb = hexToRgb(hex);
|
|
3513
|
-
if (!rgb) return true;
|
|
3514
|
-
return (rgb[0] + rgb[1] + rgb[2]) / 765 < .5;
|
|
3515
|
-
}
|
|
3516
|
-
/** Create a chainable theme builder. */
|
|
3517
|
-
function createTheme() {
|
|
3518
|
-
const state = { colors: {} };
|
|
3519
|
-
const builder = {
|
|
3520
|
-
bg(color) {
|
|
3521
|
-
state.bgColor = color;
|
|
3522
|
-
return builder;
|
|
3523
|
-
},
|
|
3524
|
-
fg(color) {
|
|
3525
|
-
state.fgColor = color;
|
|
3526
|
-
return builder;
|
|
3527
|
-
},
|
|
3528
|
-
primary(color) {
|
|
3529
|
-
state.primaryColor = color;
|
|
3530
|
-
return builder;
|
|
3531
|
-
},
|
|
3532
|
-
accent(color) {
|
|
3533
|
-
return builder.primary(color);
|
|
3534
|
-
},
|
|
3535
|
-
dark() {
|
|
3536
|
-
state.dark = true;
|
|
3537
|
-
return builder;
|
|
3538
|
-
},
|
|
3539
|
-
light() {
|
|
3540
|
-
state.dark = false;
|
|
3541
|
-
return builder;
|
|
3542
|
-
},
|
|
3543
|
-
color(name, value) {
|
|
3544
|
-
state.colors[name] = value;
|
|
3545
|
-
return builder;
|
|
3546
|
-
},
|
|
3547
|
-
palette(p) {
|
|
3548
|
-
state.presetPalette = p;
|
|
3549
|
-
return builder;
|
|
3550
|
-
},
|
|
3551
|
-
preset(name) {
|
|
3552
|
-
const p = getSchemeByName(name);
|
|
3553
|
-
if (p) state.presetPalette = p;
|
|
3554
|
-
return builder;
|
|
3555
|
-
},
|
|
3556
|
-
build() {
|
|
3557
|
-
const isDark = state.dark ?? (state.bgColor ? isDarkColor(state.bgColor) : true);
|
|
3558
|
-
let palette;
|
|
3559
|
-
if (state.presetPalette) {
|
|
3560
|
-
palette = { ...state.presetPalette };
|
|
3561
|
-
if (state.bgColor) palette.background = state.bgColor;
|
|
3562
|
-
if (state.fgColor) palette.foreground = state.fgColor;
|
|
3563
|
-
if (state.primaryColor) {
|
|
3564
|
-
palette.primary = state.primaryColor;
|
|
3565
|
-
const ansiName = hueToAnsiField(assignPrimaryToSlot(state.primaryColor));
|
|
3566
|
-
palette[ansiName] = state.primaryColor;
|
|
3567
|
-
}
|
|
3568
|
-
palette.dark = isDark;
|
|
3569
|
-
} else palette = fromColors({
|
|
3570
|
-
background: state.bgColor,
|
|
3571
|
-
foreground: state.fgColor,
|
|
3572
|
-
primary: state.primaryColor,
|
|
3573
|
-
dark: isDark
|
|
3574
|
-
});
|
|
3575
|
-
for (const [key, val] of Object.entries(state.colors)) if (val !== void 0 && typeof val === "string") palette[key] = val;
|
|
3576
|
-
return deriveTheme$1(palette);
|
|
3577
|
-
}
|
|
3578
|
-
};
|
|
3579
|
-
return builder;
|
|
3580
|
-
}
|
|
3581
|
-
/** Map a HueName to the corresponding ColorScheme field. */
|
|
3582
|
-
function hueToAnsiField(hue) {
|
|
3583
|
-
return {
|
|
3584
|
-
red: "red",
|
|
3585
|
-
orange: "brightRed",
|
|
3586
|
-
yellow: "yellow",
|
|
3587
|
-
green: "green",
|
|
3588
|
-
teal: "cyan",
|
|
3589
|
-
blue: "blue",
|
|
3590
|
-
purple: "magenta",
|
|
3591
|
-
pink: "brightMagenta"
|
|
3592
|
-
}[hue];
|
|
3593
|
-
}
|
|
3594
|
-
/**
|
|
3595
|
-
* Quick theme from a primary color or color name.
|
|
3596
|
-
*
|
|
3597
|
-
* @example
|
|
3598
|
-
* ```typescript
|
|
3599
|
-
* quickTheme('#EBCB8B', 'dark') // yellow primary, dark mode
|
|
3600
|
-
* quickTheme('blue') // blue primary, default dark
|
|
3601
|
-
* ```
|
|
3602
|
-
*/
|
|
3603
|
-
function quickTheme(primaryOrHex, mode) {
|
|
3604
|
-
const b = createTheme();
|
|
3605
|
-
if (primaryOrHex.startsWith("#")) b.primary(primaryOrHex);
|
|
3606
|
-
else b.primary({
|
|
3607
|
-
red: "#BF616A",
|
|
3608
|
-
orange: "#D08770",
|
|
3609
|
-
yellow: "#EBCB8B",
|
|
3610
|
-
green: "#A3BE8C",
|
|
3611
|
-
teal: "#88C0D0",
|
|
3612
|
-
cyan: "#88C0D0",
|
|
3613
|
-
blue: "#5E81AC",
|
|
3614
|
-
purple: "#B48EAD",
|
|
3615
|
-
pink: "#D4879C",
|
|
3616
|
-
magenta: "#B48EAD",
|
|
3617
|
-
white: "#ECEFF4"
|
|
3618
|
-
}[primaryOrHex] ?? "#5E81AC");
|
|
3619
|
-
if (mode === "dark") b.dark();
|
|
3620
|
-
else if (mode === "light") b.light();
|
|
3621
|
-
return b.build();
|
|
3622
|
-
}
|
|
3623
|
-
/**
|
|
3624
|
-
* Create a theme from a built-in preset name.
|
|
3625
|
-
*
|
|
3626
|
-
* @example
|
|
3627
|
-
* ```typescript
|
|
3628
|
-
* presetTheme('catppuccin-mocha')
|
|
3629
|
-
* presetTheme('nord')
|
|
3630
|
-
* ```
|
|
3631
|
-
*/
|
|
3632
|
-
function presetTheme(name) {
|
|
3633
|
-
return createTheme().preset(name).build();
|
|
3634
|
-
}
|
|
3635
|
-
//#endregion
|
|
3636
|
-
//#region packages/theme/src/auto-generate.ts
|
|
3637
|
-
/**
|
|
3638
|
-
* Auto-generate themes — create a complete Theme from a single primary color.
|
|
3639
|
-
*
|
|
3640
|
-
* Uses OKLCH color manipulation to derive complementary and analogous colors
|
|
3641
|
-
* for the full palette from one input color. OKLCH preserves perceived
|
|
3642
|
-
* lightness and chroma across hue rotations, so accent ramps look balanced.
|
|
3643
|
-
*/
|
|
3644
|
-
init_src();
|
|
3645
|
-
/** Standard OKLCH hue positions for semantic accents (degrees).
|
|
3646
|
-
* OKLCH hues differ from HSL: red≈29, orange≈55, yellow≈90, green≈142,
|
|
3647
|
-
* teal≈195, blue≈240, purple≈305, pink≈350. Calibrated against Ottosson's
|
|
3648
|
-
* reference ramps. */
|
|
3649
|
-
const HUE = {
|
|
3650
|
-
red: 29,
|
|
3651
|
-
orangeBright: 55,
|
|
3652
|
-
yellow: 90,
|
|
3653
|
-
green: 142,
|
|
3654
|
-
cyan: 195,
|
|
3655
|
-
blue: 240,
|
|
3656
|
-
magenta: 310,
|
|
3657
|
-
pinkBright: 350
|
|
3658
|
-
};
|
|
3659
|
-
/**
|
|
3660
|
-
* Generate a complete Theme from a single primary color.
|
|
3661
|
-
*
|
|
3662
|
-
* Derives a full ColorScheme using OKLCH color manipulation:
|
|
3663
|
-
* - Background/foreground from lightness endpoints using the primary's hue
|
|
3664
|
-
* - Complementary and analogous accent colors from hue rotation
|
|
3665
|
-
* - Surface ramp from bg lightness offsets
|
|
3666
|
-
* - Status colors (error, warning, success, info) from standard hue positions
|
|
3667
|
-
*
|
|
3668
|
-
* @param primaryColor - A hex color string (e.g. "#5E81AC")
|
|
3669
|
-
* @param mode - "dark" or "light" theme mode
|
|
3670
|
-
* @returns A complete Theme with all 33 semantic tokens
|
|
3671
|
-
*
|
|
3672
|
-
* @example
|
|
3673
|
-
* ```typescript
|
|
3674
|
-
* const theme = autoGenerateTheme("#5E81AC", "dark")
|
|
3675
|
-
* // Generates a full dark theme with blue as the primary accent
|
|
3676
|
-
*
|
|
3677
|
-
* const light = autoGenerateTheme("#E06C75", "light")
|
|
3678
|
-
* // Generates a full light theme with red/rose as the primary accent
|
|
3679
|
-
* ```
|
|
3680
|
-
*/
|
|
3681
|
-
function autoGenerateTheme(primaryColor, mode) {
|
|
3682
|
-
const o = hexToOklch(primaryColor);
|
|
3683
|
-
if (!o) return deriveTheme$1(fromColors({ dark: mode === "dark" }));
|
|
3684
|
-
const dark = mode === "dark";
|
|
3685
|
-
const bgL = dark ? .22 : .96;
|
|
3686
|
-
const fgL = dark ? .9 : .2;
|
|
3687
|
-
const bgC = Math.min(o.C, .03);
|
|
3688
|
-
const bg = oklchToHex({
|
|
3689
|
-
L: bgL,
|
|
3690
|
-
C: bgC,
|
|
3691
|
-
H: o.H
|
|
3692
|
-
});
|
|
3693
|
-
const fg = oklchToHex({
|
|
3694
|
-
L: fgL,
|
|
3695
|
-
C: bgC * .5,
|
|
3696
|
-
H: o.H
|
|
3697
|
-
});
|
|
3698
|
-
const accentL = dark ? .72 : .52;
|
|
3699
|
-
const accentC = Math.max(o.C, .1);
|
|
3700
|
-
const accent = (h) => oklchToHex({
|
|
3701
|
-
L: accentL,
|
|
3702
|
-
C: accentC,
|
|
3703
|
-
H: h
|
|
3704
|
-
});
|
|
3705
|
-
const red = accent(HUE.red);
|
|
3706
|
-
const green = accent(HUE.green);
|
|
3707
|
-
const yellow = accent(HUE.yellow);
|
|
3708
|
-
const blue = accent(HUE.blue);
|
|
3709
|
-
const magenta = accent(HUE.magenta);
|
|
3710
|
-
const cyan = accent(HUE.cyan);
|
|
3711
|
-
const brightL = accentL + (dark ? .1 : -.1);
|
|
3712
|
-
const brightAccent = (h) => oklchToHex({
|
|
3713
|
-
L: brightL,
|
|
3714
|
-
C: accentC,
|
|
3715
|
-
H: h
|
|
3716
|
-
});
|
|
3717
|
-
const brightRed = brightAccent(HUE.orangeBright);
|
|
3718
|
-
const brightGreen = brightAccent(HUE.green);
|
|
3719
|
-
const brightYellow = brightAccent(HUE.yellow);
|
|
3720
|
-
const brightBlue = brightAccent(HUE.blue);
|
|
3721
|
-
const brightMagenta = brightAccent(HUE.pinkBright);
|
|
3722
|
-
const brightCyan = brightAccent(HUE.cyan);
|
|
3723
|
-
const black = oklchToHex({
|
|
3724
|
-
L: dark ? bgL * .7 : bgL * .92,
|
|
3725
|
-
C: bgC,
|
|
3726
|
-
H: o.H
|
|
3727
|
-
});
|
|
3728
|
-
const white = oklchToHex({
|
|
3729
|
-
L: dark ? .6 : .35,
|
|
3730
|
-
C: bgC * .3,
|
|
3731
|
-
H: o.H
|
|
3732
|
-
});
|
|
3733
|
-
const brightBlack = oklchToHex({
|
|
3734
|
-
L: dark ? bgL + .1 : bgL - .08,
|
|
3735
|
-
C: bgC,
|
|
3736
|
-
H: o.H
|
|
3737
|
-
});
|
|
3738
|
-
const brightWhite = dark ? fg : oklchToHex({
|
|
3739
|
-
L: fgL - .05,
|
|
3740
|
-
C: bgC * .5,
|
|
3741
|
-
H: o.H
|
|
3742
|
-
});
|
|
3743
|
-
return deriveTheme$1({
|
|
3744
|
-
name: `generated-${mode}`,
|
|
3745
|
-
dark,
|
|
3746
|
-
primary: primaryColor,
|
|
3747
|
-
black,
|
|
3748
|
-
red,
|
|
3749
|
-
green,
|
|
3750
|
-
yellow,
|
|
3751
|
-
blue,
|
|
3752
|
-
magenta,
|
|
3753
|
-
cyan,
|
|
3754
|
-
white,
|
|
3755
|
-
brightBlack,
|
|
3756
|
-
brightRed,
|
|
3757
|
-
brightGreen,
|
|
3758
|
-
brightYellow,
|
|
3759
|
-
brightBlue,
|
|
3760
|
-
brightMagenta,
|
|
3761
|
-
brightCyan,
|
|
3762
|
-
brightWhite,
|
|
3763
|
-
foreground: fg,
|
|
3764
|
-
background: bg,
|
|
3765
|
-
cursorColor: fg,
|
|
3766
|
-
cursorText: bg,
|
|
3767
|
-
selectionBackground: blend(bg, primaryColor, .3),
|
|
3768
|
-
selectionForeground: fg
|
|
3769
|
-
});
|
|
3770
|
-
}
|
|
3771
|
-
//#endregion
|
|
3772
|
-
//#region packages/theme/src/validate.ts
|
|
3773
|
-
/**
|
|
3774
|
-
* Palette validation — checks ColorScheme fields and contrast.
|
|
3775
|
-
*/
|
|
3776
|
-
init_src();
|
|
3777
|
-
/**
|
|
3778
|
-
* Validate a ColorScheme.
|
|
3779
|
-
*
|
|
3780
|
-
* Checks:
|
|
3781
|
-
* - All 22 color fields are present and non-empty hex strings
|
|
3782
|
-
* - Warns on low-contrast foreground/background combinations
|
|
3783
|
-
*/
|
|
3784
|
-
function validateColorScheme(p) {
|
|
3785
|
-
const errors = [];
|
|
3786
|
-
const warnings = [];
|
|
3787
|
-
for (const field of COLOR_SCHEME_FIELDS) {
|
|
3788
|
-
const val = p[field];
|
|
3789
|
-
if (!val || typeof val !== "string") errors.push(`${field} is required and must be a non-empty string`);
|
|
3790
|
-
}
|
|
3791
|
-
if (p.foreground && p.background) {
|
|
3792
|
-
const fgRgb = hexToRgb(p.foreground);
|
|
3793
|
-
const bgRgb = hexToRgb(p.background);
|
|
3794
|
-
if (fgRgb && bgRgb) {
|
|
3795
|
-
const fgSum = fgRgb[0] + fgRgb[1] + fgRgb[2];
|
|
3796
|
-
const bgSum = bgRgb[0] + bgRgb[1] + bgRgb[2];
|
|
3797
|
-
if (fgSum > 384 === bgSum > 384) warnings.push(`Low contrast: foreground (${p.foreground}) and background (${p.background}) have similar lightness`);
|
|
3798
|
-
}
|
|
3799
|
-
}
|
|
3800
|
-
return {
|
|
3801
|
-
valid: errors.length === 0,
|
|
3802
|
-
errors,
|
|
3803
|
-
warnings
|
|
3804
|
-
};
|
|
3805
|
-
}
|
|
3806
|
-
//#endregion
|
|
3807
|
-
//#region packages/theme/src/validate-theme.ts
|
|
3808
|
-
/**
|
|
3809
|
-
* Theme validation — checks that all required semantic tokens are present.
|
|
3810
|
-
*
|
|
3811
|
-
* Complements validateColorScheme() which validates the lower-level
|
|
3812
|
-
* ColorScheme. This validates the derived Theme object.
|
|
3813
|
-
*/
|
|
3814
|
-
/** All 33 required semantic token keys on Theme (excludes `name` and `palette`). */
|
|
3815
|
-
const THEME_TOKEN_KEYS = [
|
|
3816
|
-
"bg",
|
|
3817
|
-
"fg",
|
|
3818
|
-
"muted",
|
|
3819
|
-
"mutedbg",
|
|
3820
|
-
"surface",
|
|
3821
|
-
"surfacebg",
|
|
3822
|
-
"popover",
|
|
3823
|
-
"popoverbg",
|
|
3824
|
-
"inverse",
|
|
3825
|
-
"inversebg",
|
|
3826
|
-
"cursor",
|
|
3827
|
-
"cursorbg",
|
|
3828
|
-
"selection",
|
|
3829
|
-
"selectionbg",
|
|
3830
|
-
"primary",
|
|
3831
|
-
"primaryfg",
|
|
3832
|
-
"secondary",
|
|
3833
|
-
"secondaryfg",
|
|
3834
|
-
"accent",
|
|
3835
|
-
"accentfg",
|
|
3836
|
-
"error",
|
|
3837
|
-
"errorfg",
|
|
3838
|
-
"warning",
|
|
3839
|
-
"warningfg",
|
|
3840
|
-
"success",
|
|
3841
|
-
"successfg",
|
|
3842
|
-
"info",
|
|
3843
|
-
"infofg",
|
|
3844
|
-
"border",
|
|
3845
|
-
"inputborder",
|
|
3846
|
-
"focusborder",
|
|
3847
|
-
"link",
|
|
3848
|
-
"disabledfg"
|
|
3849
|
-
];
|
|
3850
|
-
/** All recognized keys on Theme (tokens + metadata). */
|
|
3851
|
-
const ALL_KNOWN_KEYS = new Set([
|
|
3852
|
-
...THEME_TOKEN_KEYS,
|
|
3853
|
-
"name",
|
|
3854
|
-
"palette"
|
|
3855
|
-
]);
|
|
3856
|
-
/**
|
|
3857
|
-
* Validate a Theme object — check that all required tokens are present.
|
|
3858
|
-
*
|
|
3859
|
-
* @param theme - The theme object to validate
|
|
3860
|
-
* @returns Validation result with missing and extra token lists
|
|
3861
|
-
*
|
|
3862
|
-
* @example
|
|
3863
|
-
* ```typescript
|
|
3864
|
-
* const result = validateTheme(myTheme)
|
|
3865
|
-
* if (!result.valid) {
|
|
3866
|
-
* console.log("Missing tokens:", result.missing)
|
|
3867
|
-
* }
|
|
3868
|
-
* ```
|
|
3869
|
-
*/
|
|
3870
|
-
function validateTheme(theme) {
|
|
3871
|
-
const missing = [];
|
|
3872
|
-
const extra = [];
|
|
3873
|
-
for (const key of THEME_TOKEN_KEYS) {
|
|
3874
|
-
const val = theme[key];
|
|
3875
|
-
if (val === void 0 || val === null || val === "") missing.push(key);
|
|
3876
|
-
}
|
|
3877
|
-
for (const key of Object.keys(theme)) if (!ALL_KNOWN_KEYS.has(key)) extra.push(key);
|
|
3878
|
-
return {
|
|
3879
|
-
valid: missing.length === 0,
|
|
3880
|
-
missing,
|
|
3881
|
-
extra
|
|
3882
|
-
};
|
|
3883
|
-
}
|
|
3884
|
-
//#endregion
|
|
3885
|
-
//#region packages/theme/src/alias.ts
|
|
3886
|
-
/** Maximum depth for alias chain resolution before treating as circular. */
|
|
3887
|
-
const MAX_ALIAS_DEPTH = 10;
|
|
3888
|
-
/**
|
|
3889
|
-
* Resolve all token aliases in a theme.
|
|
3890
|
-
*
|
|
3891
|
-
* Token values that start with `$` are treated as references to other tokens.
|
|
3892
|
-
* Alias chains are followed until a concrete (non-$) value is reached.
|
|
3893
|
-
* Circular references are detected via a depth limit and left unresolved.
|
|
3894
|
-
*
|
|
3895
|
-
* @param theme - A theme-like object where values may reference other tokens via `$name`
|
|
3896
|
-
* @returns A new object with all aliases resolved to concrete values
|
|
3897
|
-
*
|
|
3898
|
-
* @example
|
|
3899
|
-
* ```typescript
|
|
3900
|
-
* const themed = resolveAliases({
|
|
3901
|
-
* ...baseTheme,
|
|
3902
|
-
* button: "$primary", // resolves to the value of 'primary'
|
|
3903
|
-
* buttonHover: "$button", // chain: buttonHover -> button -> primary -> hex
|
|
3904
|
-
* })
|
|
3905
|
-
* ```
|
|
3906
|
-
*/
|
|
3907
|
-
function resolveAliases(theme) {
|
|
3908
|
-
const result = {};
|
|
3909
|
-
for (const key of Object.keys(theme)) result[key] = resolveAlias(key, theme, 0);
|
|
3910
|
-
return result;
|
|
3911
|
-
}
|
|
3912
|
-
/**
|
|
3913
|
-
* Resolve a single token's alias chain.
|
|
3914
|
-
*
|
|
3915
|
-
* @param key - The token key to resolve
|
|
3916
|
-
* @param tokens - The full token map
|
|
3917
|
-
* @param depth - Current recursion depth (for loop detection)
|
|
3918
|
-
* @returns The resolved concrete value, or the raw alias string if unresolvable
|
|
3919
|
-
*/
|
|
3920
|
-
function resolveAlias(key, tokens, depth) {
|
|
3921
|
-
if (depth >= MAX_ALIAS_DEPTH) return tokens[key] ?? "";
|
|
3922
|
-
const value = tokens[key];
|
|
3923
|
-
if (value === void 0) return "";
|
|
3924
|
-
if (!value.startsWith("$")) return value;
|
|
3925
|
-
const refKey = value.slice(1);
|
|
3926
|
-
if (!(refKey in tokens)) return value;
|
|
3927
|
-
return resolveAlias(refKey, tokens, depth + 1);
|
|
3928
|
-
}
|
|
3929
|
-
/**
|
|
3930
|
-
* Resolve a single alias value against a Theme.
|
|
3931
|
-
*
|
|
3932
|
-
* Useful for resolving individual values without processing the entire theme.
|
|
3933
|
-
*
|
|
3934
|
-
* @param value - The value to resolve (may be "$tokenName" or a concrete value)
|
|
3935
|
-
* @param theme - The theme to resolve against
|
|
3936
|
-
* @returns The resolved concrete value
|
|
3937
|
-
*/
|
|
3938
|
-
function resolveTokenAlias(value, theme) {
|
|
3939
|
-
if (!value.startsWith("$")) return value;
|
|
3940
|
-
const seen = /* @__PURE__ */ new Set();
|
|
3941
|
-
let current = value;
|
|
3942
|
-
for (let i = 0; i < MAX_ALIAS_DEPTH; i++) {
|
|
3943
|
-
if (!current.startsWith("$")) return current;
|
|
3944
|
-
const key = current.slice(1);
|
|
3945
|
-
if (seen.has(key)) return current;
|
|
3946
|
-
seen.add(key);
|
|
3947
|
-
const resolved = theme[key];
|
|
3948
|
-
if (typeof resolved !== "string") return current;
|
|
3949
|
-
current = resolved;
|
|
3950
|
-
}
|
|
3951
|
-
return current;
|
|
3952
|
-
}
|
|
3953
|
-
//#endregion
|
|
3954
|
-
//#region packages/theme/src/sterling/flat-tokens.ts
|
|
3955
|
-
const STERLING_FLAT_TOKENS = [
|
|
3956
|
-
"bg-surface-default",
|
|
3957
|
-
"bg-surface-subtle",
|
|
3958
|
-
"bg-surface-raised",
|
|
3959
|
-
"bg-surface-overlay",
|
|
3960
|
-
"bg-surface-hover",
|
|
3961
|
-
"border-default",
|
|
3962
|
-
"border-focus",
|
|
3963
|
-
"border-muted",
|
|
3964
|
-
"fg-cursor",
|
|
3965
|
-
"bg-cursor",
|
|
3966
|
-
"fg-muted",
|
|
3967
|
-
"bg-muted",
|
|
3968
|
-
"fg-accent",
|
|
3969
|
-
"bg-accent",
|
|
3970
|
-
"fg-on-accent",
|
|
3971
|
-
"fg-accent-hover",
|
|
3972
|
-
"bg-accent-hover",
|
|
3973
|
-
"fg-accent-active",
|
|
3974
|
-
"bg-accent-active",
|
|
3975
|
-
"border-accent",
|
|
3976
|
-
"fg-info",
|
|
3977
|
-
"bg-info",
|
|
3978
|
-
"fg-on-info",
|
|
3979
|
-
"bg-info-hover",
|
|
3980
|
-
"bg-info-active",
|
|
3981
|
-
"fg-success",
|
|
3982
|
-
"bg-success",
|
|
3983
|
-
"fg-on-success",
|
|
3984
|
-
"bg-success-hover",
|
|
3985
|
-
"bg-success-active",
|
|
3986
|
-
"fg-warning",
|
|
3987
|
-
"bg-warning",
|
|
3988
|
-
"fg-on-warning",
|
|
3989
|
-
"bg-warning-hover",
|
|
3990
|
-
"bg-warning-active",
|
|
3991
|
-
"fg-error",
|
|
3992
|
-
"bg-error",
|
|
3993
|
-
"fg-on-error",
|
|
3994
|
-
"bg-error-hover",
|
|
3995
|
-
"bg-error-active"
|
|
3996
|
-
];
|
|
3997
|
-
//#endregion
|
|
3998
|
-
//#region packages/theme/src/css.ts
|
|
3999
|
-
/**
|
|
4000
|
-
* Convert a Theme to CSS custom properties.
|
|
4001
|
-
*
|
|
4002
|
-
* Token names mirror Sterling's flat grammar with a `--` prefix:
|
|
4003
|
-
* - `bg-surface-default` → `--bg-surface-default`
|
|
4004
|
-
* - `fg-accent` → `--fg-accent`
|
|
4005
|
-
* - `border-focus` → `--border-focus`
|
|
4006
|
-
* - Palette entries: `--color0` through `--color15`
|
|
4007
|
-
*
|
|
4008
|
-
* @param theme - The theme to convert (Sterling flat tokens must be populated)
|
|
4009
|
-
* @returns A record mapping CSS custom property names to color values
|
|
4010
|
-
*
|
|
4011
|
-
* @example
|
|
4012
|
-
* ```typescript
|
|
4013
|
-
* const vars = themeToCSSVars(myTheme)
|
|
4014
|
-
* // { "--bg-surface-default": "#1E1E2E", "--fg-accent": "#F9E2AF", ... }
|
|
4015
|
-
*
|
|
4016
|
-
* // Apply to an element:
|
|
4017
|
-
* Object.assign(element.style, vars)
|
|
4018
|
-
* ```
|
|
4019
|
-
*/
|
|
4020
|
-
function themeToCSSVars(theme) {
|
|
4021
|
-
const vars = {};
|
|
4022
|
-
const flat = theme;
|
|
4023
|
-
for (const key of STERLING_FLAT_TOKENS) {
|
|
4024
|
-
const value = flat[key];
|
|
4025
|
-
if (typeof value === "string") vars[`--${key}`] = value;
|
|
4026
|
-
}
|
|
4027
|
-
if (theme.palette) for (let i = 0; i < theme.palette.length; i++) vars[`--color${i}`] = theme.palette[i];
|
|
4028
|
-
return vars;
|
|
4029
|
-
}
|
|
4030
|
-
//#endregion
|
|
4031
|
-
//#region packages/theme/src/export/base16.ts
|
|
4032
|
-
/**
|
|
4033
|
-
* Export ColorScheme to Base16 YAML format.
|
|
4034
|
-
*
|
|
4035
|
-
* Maps ColorScheme fields to base00–base0F. For fields that
|
|
4036
|
-
* ColorScheme doesn't store directly (base04/base06/base07),
|
|
4037
|
-
* we interpolate between neighboring values.
|
|
4038
|
-
*
|
|
4039
|
-
* @see https://github.com/chriskempson/base16
|
|
4040
|
-
*/
|
|
4041
|
-
/** Strip `#` prefix from a hex color string and uppercase. */
|
|
4042
|
-
function stripHash(hex) {
|
|
4043
|
-
return (hex.startsWith("#") ? hex.slice(1) : hex).toUpperCase();
|
|
4044
|
-
}
|
|
4045
|
-
/**
|
|
4046
|
-
* Export a ColorScheme to Base16 YAML format.
|
|
4047
|
-
*
|
|
4048
|
-
* Mapping:
|
|
4049
|
-
* background → base00, brightBlack → base01, selectionBackground → base02,
|
|
4050
|
-
* white → base03, (interpolated) → base04, foreground → base05,
|
|
4051
|
-
* (interpolated) → base06, (interpolated) → base07,
|
|
4052
|
-
* red → base08, brightRed → base09, yellow → base0A, green → base0B,
|
|
4053
|
-
* cyan → base0C, blue → base0D, magenta → base0E, brightMagenta → base0F.
|
|
4054
|
-
*/
|
|
4055
|
-
function exportBase16(palette) {
|
|
4056
|
-
const dark = palette.dark ?? true;
|
|
4057
|
-
const base04 = blend(palette.white, palette.foreground, .33);
|
|
4058
|
-
const base06 = dark ? blend(palette.foreground, "#FFFFFF", .15) : blend(palette.foreground, "#000000", .15);
|
|
4059
|
-
const base07 = palette.black;
|
|
4060
|
-
return [
|
|
4061
|
-
`scheme: "${palette.name ?? "exported"}"`,
|
|
4062
|
-
`author: ""`,
|
|
4063
|
-
`base00: "${stripHash(palette.background)}"`,
|
|
4064
|
-
`base01: "${stripHash(palette.brightBlack)}"`,
|
|
4065
|
-
`base02: "${stripHash(palette.selectionBackground)}"`,
|
|
4066
|
-
`base03: "${stripHash(palette.white)}"`,
|
|
4067
|
-
`base04: "${stripHash(base04)}"`,
|
|
4068
|
-
`base05: "${stripHash(palette.foreground)}"`,
|
|
4069
|
-
`base06: "${stripHash(base06)}"`,
|
|
4070
|
-
`base07: "${stripHash(base07)}"`,
|
|
4071
|
-
`base08: "${stripHash(palette.red)}"`,
|
|
4072
|
-
`base09: "${stripHash(palette.brightRed)}"`,
|
|
4073
|
-
`base0A: "${stripHash(palette.yellow)}"`,
|
|
4074
|
-
`base0B: "${stripHash(palette.green)}"`,
|
|
4075
|
-
`base0C: "${stripHash(palette.cyan)}"`,
|
|
4076
|
-
`base0D: "${stripHash(palette.blue)}"`,
|
|
4077
|
-
`base0E: "${stripHash(palette.magenta)}"`,
|
|
4078
|
-
`base0F: "${stripHash(palette.brightMagenta)}"`
|
|
4079
|
-
].join("\n") + "\n";
|
|
4080
|
-
}
|
|
4081
|
-
//#endregion
|
|
4082
|
-
//#region packages/theme/src/detect.ts
|
|
4083
|
-
init_src();
|
|
4084
|
-
/**
|
|
4085
|
-
* Detect the terminal's palette and return a Sterling-aware Theme.
|
|
4086
|
-
*
|
|
4087
|
-
* Identical to `@silvery/ansi`'s `detectTheme` but every returned theme has
|
|
4088
|
-
* Sterling flat tokens baked in via `inlineSterlingTokens`.
|
|
4089
|
-
*/
|
|
4090
|
-
async function detectTheme(opts = {}) {
|
|
4091
|
-
return inlineSterlingTokens(await detectTheme$1(opts));
|
|
4092
|
-
}
|
|
4093
|
-
//#endregion
|
|
4094
|
-
//#region packages/theme/src/sterling/defaults.ts
|
|
4095
|
-
/**
|
|
4096
|
-
* A hand-tuned neutral dark scheme — not a copy of any catalog palette, but
|
|
4097
|
-
* close to Nord/Dracula territory. Used only when the caller asks for a
|
|
4098
|
-
* "raw default" (no scheme at all).
|
|
4099
|
-
*/
|
|
4100
|
-
const darkBaseline = {
|
|
4101
|
-
name: "sterling-dark",
|
|
4102
|
-
dark: true,
|
|
4103
|
-
primary: "#7FB4CA",
|
|
4104
|
-
black: "#1E1E2E",
|
|
4105
|
-
red: "#E06C75",
|
|
4106
|
-
green: "#98C379",
|
|
4107
|
-
yellow: "#E5C07B",
|
|
4108
|
-
blue: "#61AFEF",
|
|
4109
|
-
magenta: "#C678DD",
|
|
4110
|
-
cyan: "#56B6C2",
|
|
4111
|
-
white: "#ABB2BF",
|
|
4112
|
-
brightBlack: "#5C6370",
|
|
4113
|
-
brightRed: "#E06C75",
|
|
4114
|
-
brightGreen: "#98C379",
|
|
4115
|
-
brightYellow: "#E5C07B",
|
|
4116
|
-
brightBlue: "#61AFEF",
|
|
4117
|
-
brightMagenta: "#C678DD",
|
|
4118
|
-
brightCyan: "#56B6C2",
|
|
4119
|
-
brightWhite: "#FFFFFF",
|
|
4120
|
-
foreground: "#E4E4E7",
|
|
4121
|
-
background: "#16181D",
|
|
4122
|
-
cursorColor: "#E4E4E7",
|
|
4123
|
-
cursorText: "#16181D",
|
|
4124
|
-
selectionBackground: "#3E4452",
|
|
4125
|
-
selectionForeground: "#E4E4E7"
|
|
4126
|
-
};
|
|
4127
|
-
const lightBaseline = {
|
|
4128
|
-
name: "sterling-light",
|
|
4129
|
-
dark: false,
|
|
4130
|
-
primary: "#1F6FEB",
|
|
4131
|
-
black: "#24292F",
|
|
4132
|
-
red: "#CF222E",
|
|
4133
|
-
green: "#1A7F37",
|
|
4134
|
-
yellow: "#9A6700",
|
|
4135
|
-
blue: "#0969DA",
|
|
4136
|
-
magenta: "#8250DF",
|
|
4137
|
-
cyan: "#1B7C83",
|
|
4138
|
-
white: "#6E7781",
|
|
4139
|
-
brightBlack: "#57606A",
|
|
4140
|
-
brightRed: "#A40E26",
|
|
4141
|
-
brightGreen: "#2DA44E",
|
|
4142
|
-
brightYellow: "#BF8700",
|
|
4143
|
-
brightBlue: "#218BFF",
|
|
4144
|
-
brightMagenta: "#A475F9",
|
|
4145
|
-
brightCyan: "#3192AA",
|
|
4146
|
-
brightWhite: "#8C959F",
|
|
4147
|
-
foreground: "#1F2328",
|
|
4148
|
-
background: "#FFFFFF",
|
|
4149
|
-
cursorColor: "#1F2328",
|
|
4150
|
-
cursorText: "#FFFFFF",
|
|
4151
|
-
selectionBackground: "#DDF4FF",
|
|
4152
|
-
selectionForeground: "#1F2328"
|
|
4153
|
-
};
|
|
4154
|
-
function defaultScheme(mode = "dark") {
|
|
4155
|
-
return mode === "dark" ? darkBaseline : lightBaseline;
|
|
4156
|
-
}
|
|
4157
|
-
//#endregion
|
|
4158
|
-
//#region packages/theme/src/sterling/define.ts
|
|
4159
|
-
init_src();
|
|
4160
|
-
function resolveFlatten(flatten) {
|
|
4161
|
-
if (flatten === false || flatten === void 0) return (t) => t;
|
|
4162
|
-
if (typeof flatten === "function") {
|
|
4163
|
-
const rule = flatten;
|
|
4164
|
-
return (t) => bakeFlat(t, rule);
|
|
4165
|
-
}
|
|
4166
|
-
return (t) => bakeFlat(t);
|
|
4167
|
-
}
|
|
4168
|
-
/**
|
|
4169
|
-
* Wrap a DesignSystem so every derivation method auto-applies `bakeFlat`
|
|
4170
|
-
* per the `flatten` flag. Pass your raw system (one that returns nested
|
|
4171
|
-
* themes) and this returns a user-facing system whose outputs have flat
|
|
4172
|
-
* keys populated.
|
|
4173
|
-
*/
|
|
4174
|
-
function defineDesignSystem(def) {
|
|
4175
|
-
const flatten = resolveFlatten(def.flatten);
|
|
4176
|
-
return {
|
|
4177
|
-
name: def.name,
|
|
4178
|
-
shape: def.shape,
|
|
4179
|
-
flatten: def.flatten,
|
|
4180
|
-
defaults: (mode) => flatten(def.defaults(mode)),
|
|
4181
|
-
theme: (partial, opts) => flatten(def.theme(partial, opts)),
|
|
4182
|
-
deriveFromScheme: (scheme, opts) => flatten(def.deriveFromScheme(scheme, opts)),
|
|
4183
|
-
deriveFromColor: (color, opts) => flatten(def.deriveFromColor(color, opts)),
|
|
4184
|
-
deriveFromPair: (light, dark, opts) => {
|
|
4185
|
-
const pair = def.deriveFromPair(light, dark, opts);
|
|
4186
|
-
return {
|
|
4187
|
-
light: flatten(pair.light),
|
|
4188
|
-
dark: flatten(pair.dark)
|
|
4189
|
-
};
|
|
4190
|
-
},
|
|
4191
|
-
deriveFromSchemeWithBrand: (scheme, brand, opts) => flatten(def.deriveFromSchemeWithBrand(scheme, brand, opts))
|
|
4192
|
-
};
|
|
4193
|
-
}
|
|
4194
|
-
//#endregion
|
|
4195
|
-
//#region packages/theme/src/sterling/sterling.ts
|
|
4196
|
-
/**
|
|
4197
|
-
* Sterling — silvery's canonical DesignSystem.
|
|
4198
|
-
*
|
|
4199
|
-
* This is the default system shipped from `@silvery/theme`. It implements
|
|
4200
|
-
* the `DesignSystem` contract from `types.ts` and serves as the reference
|
|
4201
|
-
* for alternative systems (`@silvery/design-material`, `-primer`, etc.).
|
|
4202
|
-
*
|
|
4203
|
-
* The flat-projection (`theme["bg-accent"]` as a sibling of `theme.accent.bg`
|
|
4204
|
-
* on the same object) is NOT Sterling-specific — it's a framework feature.
|
|
4205
|
-
* Sterling opts in via `flatten: true` in {@link defineDesignSystem}, which
|
|
4206
|
-
* auto-applies `bakeFlat` (from `@silvery/ansi`) to every derivation's
|
|
4207
|
-
* output. The default rule is channel-role-state (`fg-accent`, `bg-accent-hover`,
|
|
4208
|
-
* `fg-on-error`, `bg-surface-subtle`, `border-focus`, …) — exactly what
|
|
4209
|
-
* Sterling's pre-generalization `populateFlat` produced.
|
|
4210
|
-
*
|
|
4211
|
-
* All derivation functions return a frozen Theme with both nested roles
|
|
4212
|
-
* AND flat hyphen keys populated — the user-facing `$fg-accent` syntax
|
|
4213
|
-
* resolves against the flat keys, while programmatic access uses nested.
|
|
4214
|
-
*/
|
|
4215
|
-
const STERLING_SHAPE = {
|
|
4216
|
-
flatTokens: STERLING_FLAT_TOKENS,
|
|
4217
|
-
roles: [
|
|
4218
|
-
"accent",
|
|
4219
|
-
"info",
|
|
4220
|
-
"success",
|
|
4221
|
-
"warning",
|
|
4222
|
-
"error",
|
|
4223
|
-
"muted",
|
|
4224
|
-
"surface",
|
|
4225
|
-
"border",
|
|
4226
|
-
"cursor"
|
|
4227
|
-
],
|
|
4228
|
-
states: ["hover", "active"]
|
|
4229
|
-
};
|
|
4230
|
-
/**
|
|
4231
|
-
* Internal: build a nested Theme (no flat keys). `defineDesignSystem` applies
|
|
4232
|
-
* `bakeFlat` afterwards — the inner derivation stays flat-agnostic.
|
|
4233
|
-
*/
|
|
4234
|
-
function buildRawTheme(scheme, opts = {}) {
|
|
4235
|
-
return deriveTheme(scheme, opts);
|
|
4236
|
-
}
|
|
4237
|
-
/**
|
|
4238
|
-
* Apply a brand overlay to a ColorScheme — overrides `primary` and relevant
|
|
4239
|
-
* ANSI hue slots with the brand color. Keeps the rest of the scheme intact.
|
|
4240
|
-
* Per Appendix F: brand is a theme INPUT, not a public token sibling of accent.
|
|
4241
|
-
*/
|
|
4242
|
-
function applyBrand(scheme, brand) {
|
|
4243
|
-
return {
|
|
4244
|
-
...scheme,
|
|
4245
|
-
primary: brand
|
|
4246
|
-
};
|
|
4247
|
-
}
|
|
4248
|
-
/**
|
|
4249
|
-
* Sterling — the user-facing DesignSystem. `defineDesignSystem` wraps
|
|
4250
|
-
* `rawSterling` with auto-`bakeFlat` (per `flatten: true`), so every
|
|
4251
|
-
* returned Theme has both nested roles AND flat hyphen keys populated.
|
|
4252
|
-
*/
|
|
4253
|
-
const sterling = defineDesignSystem({
|
|
4254
|
-
name: "sterling",
|
|
4255
|
-
shape: STERLING_SHAPE,
|
|
4256
|
-
flatten: true,
|
|
4257
|
-
defaults(mode = "dark") {
|
|
4258
|
-
return buildRawTheme(defaultScheme(mode), { contrast: "auto-lift" });
|
|
4259
|
-
},
|
|
4260
|
-
theme(partial, opts = {}) {
|
|
4261
|
-
const base = buildRawTheme(defaultScheme(opts.mode ?? "dark"), {
|
|
4262
|
-
...opts,
|
|
4263
|
-
contrast: opts.contrast ?? "auto-lift"
|
|
4264
|
-
});
|
|
4265
|
-
if (!partial) return base;
|
|
4266
|
-
return mergePartial(base, partial);
|
|
4267
|
-
},
|
|
4268
|
-
deriveFromScheme(scheme, opts = {}) {
|
|
4269
|
-
return buildRawTheme(scheme, opts);
|
|
4270
|
-
},
|
|
4271
|
-
deriveFromColor(color, opts = {}) {
|
|
4272
|
-
return buildRawTheme({
|
|
4273
|
-
...defaultScheme(opts.mode ?? "dark"),
|
|
4274
|
-
name: `seed:${color}`,
|
|
4275
|
-
primary: color,
|
|
4276
|
-
blue: color,
|
|
4277
|
-
brightBlue: blend(color, "#ffffff", .15)
|
|
4278
|
-
}, opts);
|
|
4279
|
-
},
|
|
4280
|
-
deriveFromPair(light, dark, opts = {}) {
|
|
4281
|
-
return {
|
|
4282
|
-
light: buildRawTheme(light, {
|
|
4283
|
-
...opts,
|
|
4284
|
-
mode: "light"
|
|
4285
|
-
}),
|
|
4286
|
-
dark: buildRawTheme(dark, {
|
|
4287
|
-
...opts,
|
|
4288
|
-
mode: "dark"
|
|
4289
|
-
})
|
|
4290
|
-
};
|
|
4291
|
-
},
|
|
4292
|
-
deriveFromSchemeWithBrand(scheme, brand, opts = {}) {
|
|
4293
|
-
return buildRawTheme(applyBrand(scheme, brand), opts);
|
|
4294
|
-
}
|
|
4295
|
-
});
|
|
4296
|
-
//#endregion
|
|
4297
|
-
//#region packages/theme/src/sterling/index.ts
|
|
4298
|
-
init_src();
|
|
4299
|
-
//#endregion
|
|
4300
|
-
//#region packages/theme/src/theme.ts
|
|
4301
|
-
init_src();
|
|
4302
|
-
//#endregion
|
|
4303
|
-
export { kanagawaLotus as $, modusVivendi as A, nightfox as B, builtinPalettes as C, checkAA as Ct, getSchemeByName as D, defaultLightTheme as E, oxocarbonLight as F, materialDark as G, ayuLight as H, nightfly as I, monokai as J, materialLight as K, moonfly as L, edgeLight as M, sonokai as N, getThemeByName as O, oxocarbonDark as P, kanagawaDragon as Q, horizon as R, ansi16LightTheme as S, autoLift as St, defaultDarkTheme as T, generateTheme as Tt, ayuMirage as U, ayuDark as V, palenight as W, everforestDark as X, monokaiPro as Y, everforestLight as Z, assignPrimaryToSlot as _, catppuccinMocha as _t, exportBase16 as a, gruvboxLight as at, fromPreset as b, ContrastError as bt, resolveAliases as c, tokyoNightDay as ct, validateTheme as d, solarizedLight as dt, kanagawaWave as et, validateColorScheme as f, dracula as ft, quickTheme as g, catppuccinMacchiato as gt, presetTheme as h, catppuccinLatte as ht, detectTheme as i, gruvboxDark as it, edgeDark as j, modusOperandi as k, resolveTokenAlias as l, tokyoNightStorm as lt, createTheme as m, catppuccinFrappe as mt, defineDesignSystem as n, rosePineDawn as nt, themeToCSSVars as o, oneDark as ot, autoGenerateTheme as p, nord as pt, snazzy as q, defaultScheme as r, rosePineMoon as rt, STERLING_FLAT_TOKENS as s, tokyoNight as st, sterling as t, rosePine as tt, THEME_TOKEN_KEYS as u, solarizedDark as ut, fromBase16 as v, deriveRoles as vt, builtinThemes as w, importBase16 as wt, ansi16DarkTheme as x, WCAG_AA as xt, fromColors as y, deriveTheme as yt, dawnfox as z };
|
|
2514
|
+
export { everforestDark as A, oneDark as B, ayuMirage as C, snazzy as D, materialLight as E, rosePine as F, solarizedLight as G, tokyoNightDay as H, rosePineDawn as I, catppuccinFrappe as J, dracula as K, rosePineMoon as L, kanagawaDragon as M, kanagawaLotus as N, monokai as O, kanagawaWave as P, gruvboxDark as R, ayuLight as S, materialDark as T, tokyoNightStorm as U, tokyoNight as V, solarizedDark as W, catppuccinMacchiato as X, catppuccinLatte as Y, catppuccinMocha as Z, moonfly as _, defaultDarkTheme as a, nightfox as b, getThemeByName as c, edgeDark as d, edgeLight as f, nightfly as g, oxocarbonLight as h, builtinThemes as i, everforestLight as j, monokaiPro as k, modusOperandi as l, oxocarbonDark as m, ansi16LightTheme as n, defaultLightTheme as o, sonokai as p, nord as q, builtinPalettes as r, getSchemeByName as s, ansi16DarkTheme as t, modusVivendi as u, horizon as v, palenight as w, ayuDark as x, dawnfox as y, gruvboxLight as z };
|
|
4304
2515
|
|
|
4305
|
-
//# sourceMappingURL=
|
|
2516
|
+
//# sourceMappingURL=schemes-DYt2ushj.mjs.map
|