@bismawy/pi-arnative 0.9.1 → 0.10.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/CHANGELOG.md +79 -0
- package/README.md +2 -2
- package/extensions/animations.ts +1 -1
- package/extensions/arnative.ts +21 -10
- package/extensions/autocompact.ts +0 -0
- package/extensions/footer.ts +0 -0
- package/extensions/model-heal.ts +32 -5
- package/extensions/section-headers.ts +0 -0
- package/extensions/timestamps.ts +0 -0
- package/extensions/todos.ts +43 -15
- package/extensions/tools.ts +128 -11
- package/extensions/ui-render-tweaks.ts +5 -5
- package/extensions/usage.ts +309 -19
- package/lib/ansi.ts +22 -12
- package/lib/box.ts +1 -1
- package/lib/check.ts +0 -0
- package/lib/compat.ts +13 -64
- package/lib/format.ts +0 -0
- package/lib/list-picker.ts +117 -22
- package/lib/model-heal.ts +63 -9
- package/lib/patch.ts +0 -0
- package/lib/preset-store.ts +0 -0
- package/lib/provider.ts +151 -66
- package/lib/shortcuts.ts +36 -20
- package/lib/spinner.ts +0 -0
- package/lib/status-widget.ts +14 -0
- package/lib/todos.ts +0 -0
- package/lib/usage-store.ts +227 -24
- package/package.json +1 -1
- package/themes/arnative-blossom.json +89 -0
- package/themes/arnative-crimson.json +89 -0
- package/themes/arnative-cyberpunk.json +28 -28
- package/themes/arnative-dracula.json +40 -39
- package/themes/arnative-earthy.json +89 -0
- package/themes/arnative-garden.json +89 -0
- package/themes/arnative-gruvbox.json +40 -39
- package/themes/arnative-lemonade.json +89 -0
- package/themes/{arnative-synthwave.json → arnative-magical.json} +32 -31
- package/themes/arnative-matrix.json +37 -36
- package/themes/arnative-neutral.json +89 -0
- package/themes/arnative-nord.json +43 -42
- package/themes/arnative-zinc.json +43 -42
- package/themes/arnative.json +32 -31
- package/themes/gen-themes.mjs +376 -129
- package/themes/arnative-emerald.json +0 -88
- package/themes/arnative-sun.json +0 -88
- package/themes/arnative-violet.json +0 -88
package/themes/gen-themes.mjs
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import { readFile, writeFile } from "node:fs/promises";
|
|
14
14
|
import { dirname, join } from "node:path";
|
|
15
15
|
import { fileURLToPath } from "node:url";
|
|
16
|
-
import { parseOklch, oklchToRgb } from "../lib/color.ts";
|
|
16
|
+
import { contrast, hexToOklch, parseOklch, oklchToRgb, toHex } from "../lib/color.ts";
|
|
17
17
|
import { assert } from "../lib/check.ts";
|
|
18
18
|
|
|
19
19
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
@@ -33,20 +33,33 @@ function oklch(L, C, H) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* Soft tier of a color: clone at
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
36
|
+
* Soft tier of a color: clone at lightness `l` (default 0.82) with `scale`
|
|
37
|
+
* (default 0.5, matching `SOFT_CHROMA_SCALE` in lib/ansi.ts; the accent tier
|
|
38
|
+
* uses 0.15 at 0.94 lightness — a near-white tint — matching
|
|
39
|
+
* `SOFT_CHROMA_SCALE_ACCENT` and `SOFT_L_ACCENT`) of the GAMUT-CLAMPED
|
|
40
|
+
* chroma, hue kept. `lib/ansi.ts` softens the resolved token with these same
|
|
41
|
+
* recipes at runtime, so `*Soft` vars declared here and the extension's derived
|
|
42
|
+
* values agree. Grey-collapse is avoided because the hue is carried, not dropped.
|
|
40
43
|
*
|
|
41
|
-
* The chroma keeps five decimals (not the usual three): the soft tier multiplies
|
|
42
|
-
*
|
|
43
|
-
* guard in ui-render-tweaks.ts fails.
|
|
44
|
+
* The chroma keeps five decimals (not the usual three): the soft tier multiplies
|
|
45
|
+
* it by the scale, so a coarser round-trip shifts the last hex digit and the
|
|
46
|
+
* `declare == derive` guard in ui-render-tweaks.ts fails.
|
|
44
47
|
*/
|
|
45
|
-
function soften(value) {
|
|
48
|
+
function soften(value, scale = 0.35, l = 0.90) {
|
|
46
49
|
const o = parseOklch(value);
|
|
47
50
|
assert(o !== null, `cannot soften a non-oklch color: ${value}`);
|
|
48
|
-
const { chroma } = oklchToRgb(
|
|
49
|
-
return `oklch(
|
|
51
|
+
const { chroma } = oklchToRgb(l, o.C * scale, o.H);
|
|
52
|
+
return `oklch(${+(l * 100).toFixed(1)}% ${+chroma.toFixed(5)} ${Math.round(hue(o.H))})`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Normalize a spec color to an oklch literal: hex is converted, oklch passes through. */
|
|
56
|
+
function colorLiteral(value) {
|
|
57
|
+
const s = String(value).trim();
|
|
58
|
+
if (s.startsWith("#")) {
|
|
59
|
+
const o = hexToOklch(s);
|
|
60
|
+
return oklch(o.L, o.C, o.H);
|
|
61
|
+
}
|
|
62
|
+
return s;
|
|
50
63
|
}
|
|
51
64
|
|
|
52
65
|
// --- shared ramps ----------------------------------------------------------
|
|
@@ -79,152 +92,314 @@ const ACCENT_OFFSET = {
|
|
|
79
92
|
*/
|
|
80
93
|
const THEMES = {
|
|
81
94
|
arnative: {
|
|
82
|
-
|
|
95
|
+
// Cyan & gold: strong-cyan focus, bright-gold signature (primary), school-bus
|
|
96
|
+
// yellow labels, icy-aqua links/code (tone), deep teal message panels.
|
|
97
|
+
accent: "oklch(77% 0.13 193)",
|
|
83
98
|
chroma: 0.13,
|
|
84
99
|
canvasL: 0.27,
|
|
85
|
-
neutralHue:
|
|
86
|
-
neutralChroma: 0.012,
|
|
87
|
-
primary: "oklch(82% 0.14 218)",
|
|
88
|
-
secondary: "oklch(78% 0.11 282)",
|
|
89
|
-
hues: { heading: 75, label: 282 },
|
|
90
|
-
},
|
|
91
|
-
"arnative-sun": {
|
|
92
|
-
accent: "oklch(82.4% 0.1408 70.170730)",
|
|
93
|
-
chroma: 0.14,
|
|
94
|
-
canvasL: 0.27,
|
|
95
|
-
neutralHue: 70,
|
|
96
|
-
neutralChroma: 0.012,
|
|
97
|
-
primary: "oklch(84% 0.15 70)",
|
|
98
|
-
secondary: "oklch(78% 0.12 35)",
|
|
99
|
-
hues: { heading: 60, label: 330 },
|
|
100
|
-
},
|
|
101
|
-
"arnative-zinc": {
|
|
102
|
-
accent: "oklch(71.2% 0.0129 286.066504)",
|
|
103
|
-
chroma: 0.02,
|
|
104
|
-
canvasL: 0.26,
|
|
105
|
-
neutralHue: 285,
|
|
106
|
-
neutralChroma: 0.005,
|
|
107
|
-
primary: "oklch(86% 0.015 285)",
|
|
108
|
-
secondary: "oklch(72% 0.025 240)",
|
|
109
|
-
hues: { heading: 285, label: 285 },
|
|
110
|
-
},
|
|
111
|
-
"arnative-violet": {
|
|
112
|
-
accent: "oklch(70.9% 0.1592 293.541199)",
|
|
113
|
-
chroma: 0.14,
|
|
114
|
-
canvasL: 0.27,
|
|
115
|
-
neutralHue: 295,
|
|
100
|
+
neutralHue: 205,
|
|
116
101
|
neutralChroma: 0.012,
|
|
117
|
-
primary: "oklch(
|
|
118
|
-
secondary: "oklch(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
accent
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
hues: { heading:
|
|
102
|
+
primary: "oklch(88.8% 0.181 96)",
|
|
103
|
+
secondary: "oklch(84.2% 0.172 86)",
|
|
104
|
+
tone: "oklch(95.1% 0.073 196)",
|
|
105
|
+
// Teal panel, deepened to L:19% for stealth dark contrast.
|
|
106
|
+
surfaceMsg: "oklch(19% 0.04 191)",
|
|
107
|
+
// The label tier follows the accent (soft cyan); the gold signature lives on
|
|
108
|
+
// headings and links instead, so the theme keeps two tones without the label gap.
|
|
109
|
+
borderAccent: "accentSoft",
|
|
110
|
+
headingColor: "primary",
|
|
111
|
+
linkColor: "primary",
|
|
112
|
+
codeColor: "tone",
|
|
113
|
+
bulletColor: "accent",
|
|
114
|
+
hues: { heading: 96, label: 96, link: 196, code: 196, bullet: 193, border: 86, selected: 86 },
|
|
130
115
|
},
|
|
131
|
-
"arnative-
|
|
132
|
-
accent
|
|
116
|
+
"arnative-cyberpunk": {
|
|
117
|
+
// Neon fuchsia focus (#ea00d9, accent), electric cyan headings & model (#0abdc6, primary),
|
|
118
|
+
// deep purple secondary (#711c91, secondary), and deep violet panels.
|
|
119
|
+
accent: "oklch(76% 0.22 332)",
|
|
133
120
|
chroma: 0.22,
|
|
134
121
|
canvasL: 0.24,
|
|
135
|
-
neutralHue:
|
|
122
|
+
neutralHue: 275,
|
|
136
123
|
neutralChroma: 0.02,
|
|
137
|
-
primary: "oklch(
|
|
138
|
-
secondary: "oklch(
|
|
139
|
-
surfaceMsg: "
|
|
124
|
+
primary: "oklch(72.7% 0.123 201)",
|
|
125
|
+
secondary: "oklch(42.4% 0.183 314)",
|
|
126
|
+
surfaceMsg: "primary",
|
|
127
|
+
borderAccent: "accentSoft",
|
|
128
|
+
headingColor: "primary",
|
|
129
|
+
linkColor: "primary",
|
|
130
|
+
codeColor: "accent",
|
|
131
|
+
bulletColor: "accent",
|
|
140
132
|
hues: {
|
|
141
|
-
heading:
|
|
142
|
-
keyword:
|
|
133
|
+
heading: 201, label: 201, link: 201, code: 332, bullet: 332, border: 201, selected: 201, searchMatch: 332,
|
|
134
|
+
keyword: 332, func: 201, variable: 332, string: 140, number: 45, type: 201,
|
|
143
135
|
},
|
|
144
136
|
},
|
|
145
|
-
"arnative-
|
|
146
|
-
accent
|
|
147
|
-
|
|
137
|
+
"arnative-crimson": {
|
|
138
|
+
// Garnet red focus (#941b0c, accent), fiery burnt orange headings (#bc3908 adjusted to L:58%, primary),
|
|
139
|
+
// golden amber secondary (#f6aa1c, secondary), and deep red-brown panels (#361715, surfaceMsg).
|
|
140
|
+
accent: "oklch(74% 0.16 31)",
|
|
141
|
+
chroma: 0.16,
|
|
148
142
|
canvasL: 0.24,
|
|
149
|
-
neutralHue:
|
|
150
|
-
neutralChroma: 0.
|
|
151
|
-
primary: "oklch(
|
|
152
|
-
secondary: "oklch(
|
|
153
|
-
|
|
154
|
-
|
|
143
|
+
neutralHue: 31,
|
|
144
|
+
neutralChroma: 0.015,
|
|
145
|
+
primary: "oklch(58% 0.175 37)",
|
|
146
|
+
secondary: "oklch(79.2% 0.161 75)",
|
|
147
|
+
tone: "oklch(82% 0.14 70)",
|
|
148
|
+
surfaceMsg: "primary",
|
|
149
|
+
borderAccent: "accentSoft",
|
|
155
150
|
headingColor: "primary",
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
151
|
+
linkColor: "tone",
|
|
152
|
+
codeColor: "tone",
|
|
153
|
+
bulletColor: "accent",
|
|
159
154
|
hues: {
|
|
160
|
-
heading:
|
|
161
|
-
keyword:
|
|
155
|
+
heading: 37, label: 37, link: 70, code: 70, bullet: 31, border: 75, selected: 75, searchMatch: 31,
|
|
156
|
+
keyword: 31, func: 75, variable: 31, string: 145, number: 75, type: 70,
|
|
162
157
|
},
|
|
163
158
|
},
|
|
164
|
-
"arnative-
|
|
165
|
-
accent
|
|
166
|
-
|
|
159
|
+
"arnative-matrix": {
|
|
160
|
+
// Medium-jungle green focus (#009a22, accent), bright phosphor-green headings & model (#00ff2b, primary),
|
|
161
|
+
// lime green secondary (#36ba01, secondary), and jet-black teal panels (#0a2e36, surfaceMsg).
|
|
162
|
+
// AccentSoft provides the bright, soft matrix pastel green for footer labels.
|
|
163
|
+
accent: "oklch(74% 0.191 144)",
|
|
164
|
+
chroma: 0.19,
|
|
167
165
|
canvasL: 0.24,
|
|
168
|
-
neutralHue:
|
|
166
|
+
neutralHue: 215,
|
|
169
167
|
neutralChroma: 0.015,
|
|
170
|
-
primary: "oklch(
|
|
171
|
-
secondary: "oklch(
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
168
|
+
primary: "oklch(86.7% 0.287 143)",
|
|
169
|
+
secondary: "oklch(69% 0.223 140)",
|
|
170
|
+
tone: "oklch(82% 0.12 175)",
|
|
171
|
+
surfaceMsg: "primary",
|
|
172
|
+
borderAccent: "accentSoft",
|
|
173
|
+
headingColor: "primary",
|
|
174
|
+
linkColor: "tone",
|
|
175
|
+
codeColor: "tone",
|
|
175
176
|
bulletColor: "primary",
|
|
176
177
|
hues: {
|
|
177
|
-
heading:
|
|
178
|
-
keyword:
|
|
178
|
+
heading: 143, label: 143, link: 175, code: 175, bullet: 143, border: 140, selected: 140, searchMatch: 144,
|
|
179
|
+
keyword: 144, func: 143, variable: 175, string: 144, number: 85, type: 175,
|
|
179
180
|
},
|
|
180
181
|
},
|
|
181
|
-
"arnative-
|
|
182
|
-
accent
|
|
183
|
-
|
|
182
|
+
"arnative-neutral": {
|
|
183
|
+
// Grey-olive focus (#8a817c, accent), powder-blush warm headings (#e0afa0, primary),
|
|
184
|
+
// silver grey links/code & secondary (#bcb8b1, secondary), and deep warm-taupe panels.
|
|
185
|
+
accent: "oklch(76% 0.035 51)",
|
|
186
|
+
chroma: 0.035,
|
|
184
187
|
canvasL: 0.24,
|
|
185
|
-
neutralHue:
|
|
186
|
-
neutralChroma: 0.
|
|
187
|
-
primary: "oklch(
|
|
188
|
-
secondary: "oklch(78% 0.
|
|
189
|
-
|
|
188
|
+
neutralHue: 58,
|
|
189
|
+
neutralChroma: 0.008,
|
|
190
|
+
primary: "oklch(79.5% 0.061 38)",
|
|
191
|
+
secondary: "oklch(78.4% 0.011 82)",
|
|
192
|
+
tone: "oklch(82% 0.015 82)",
|
|
193
|
+
surfaceMsg: "primary",
|
|
194
|
+
borderAccent: "accentSoft",
|
|
195
|
+
headingColor: "primary",
|
|
196
|
+
linkColor: "tone",
|
|
197
|
+
codeColor: "tone",
|
|
198
|
+
bulletColor: "accent",
|
|
199
|
+
hues: {
|
|
200
|
+
heading: 38, label: 38, link: 82, code: 82, bullet: 51, border: 82, selected: 82, searchMatch: 51,
|
|
201
|
+
keyword: 51, func: 38, variable: 82, string: 97, number: 51, type: 82,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
"arnative-zinc": {
|
|
205
|
+
// Zinc: ash grey focus (#b8bdb5, accent), cool steel headings & model (#889696, primary),
|
|
206
|
+
// dust grey footer labels & secondary (#d2d4c8, secondary), and deep slate-zinc panels.
|
|
207
|
+
accent: "oklch(79.2% 0.035 133)",
|
|
208
|
+
chroma: 0.035,
|
|
209
|
+
canvasL: 0.25,
|
|
210
|
+
neutralHue: 120,
|
|
211
|
+
neutralChroma: 0.008,
|
|
212
|
+
primary: "oklch(66.2% 0.016 197)",
|
|
213
|
+
secondary: "oklch(86.5% 0.016 114)",
|
|
214
|
+
tone: "oklch(80% 0.03 197)",
|
|
215
|
+
surfaceMsg: "primary",
|
|
216
|
+
borderAccent: "accentSoft",
|
|
190
217
|
headingColor: "primary",
|
|
191
|
-
|
|
218
|
+
linkColor: "tone",
|
|
219
|
+
codeColor: "tone",
|
|
192
220
|
bulletColor: "accent",
|
|
193
221
|
hues: {
|
|
194
|
-
heading:
|
|
195
|
-
keyword:
|
|
222
|
+
heading: 197, label: 197, link: 197, code: 197, bullet: 133, border: 114, selected: 114, searchMatch: 133,
|
|
223
|
+
keyword: 133, func: 197, variable: 114, string: 114, number: 114, type: 197,
|
|
196
224
|
},
|
|
197
225
|
},
|
|
198
226
|
"arnative-nord": {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
227
|
+
// Nord polar night: dark slate canvas, polar navy focus (#3c455c adapted to L:76%, accent),
|
|
228
|
+
// frosted blue-grey headings & model (#697d97, primary), slate-purple footer labels (#777696, secondary),
|
|
229
|
+
// and deep slate-blue panels.
|
|
230
|
+
accent: "oklch(76% 0.06 268)",
|
|
231
|
+
chroma: 0.06,
|
|
232
|
+
canvasL: 0.26,
|
|
233
|
+
neutralHue: 255,
|
|
234
|
+
neutralChroma: 0.012,
|
|
235
|
+
primary: "oklch(58.3% 0.047 255)",
|
|
236
|
+
secondary: "oklch(57.8% 0.049 286)",
|
|
237
|
+
tone: "oklch(80% 0.05 194)",
|
|
238
|
+
surfaceMsg: "primary",
|
|
239
|
+
borderAccent: "accentSoft",
|
|
240
|
+
headingColor: "primary",
|
|
241
|
+
linkColor: "tone",
|
|
242
|
+
codeColor: "tone",
|
|
243
|
+
bulletColor: "accent",
|
|
209
244
|
hues: {
|
|
210
|
-
heading:
|
|
211
|
-
keyword:
|
|
245
|
+
heading: 255, label: 255, link: 194, code: 194, bullet: 268, border: 286, selected: 286, searchMatch: 268,
|
|
246
|
+
keyword: 268, func: 255, variable: 286, string: 131, number: 286, type: 194,
|
|
212
247
|
},
|
|
213
248
|
},
|
|
214
249
|
"arnative-dracula": {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
250
|
+
// Dracula: night canvas #282a36 with #44475a panels, pink focus #ff80bf (accent),
|
|
251
|
+
// purple headings & model name #9580ff (primary), bright yellow footer labels #ffff80 (secondary),
|
|
252
|
+
// cyan links and code #8be9fd (tone).
|
|
253
|
+
accent: "oklch(76.2% 0.168 351)",
|
|
254
|
+
chroma: 0.17,
|
|
255
|
+
canvasL: 0.28,
|
|
256
|
+
neutralHue: 278,
|
|
219
257
|
neutralChroma: 0.012,
|
|
220
|
-
primary: "oklch(
|
|
221
|
-
secondary: "oklch(
|
|
258
|
+
primary: "oklch(67.8% 0.181 288)",
|
|
259
|
+
secondary: "oklch(97.5% 0.149 109)",
|
|
260
|
+
tone: "oklch(86% 0.09 213)",
|
|
261
|
+
surfaceMsg: "primary",
|
|
222
262
|
borderAccent: "secondary",
|
|
223
|
-
|
|
263
|
+
headingColor: "primary",
|
|
264
|
+
linkColor: "tone",
|
|
265
|
+
codeColor: "tone",
|
|
266
|
+
bulletColor: "accent",
|
|
267
|
+
hues: {
|
|
268
|
+
heading: 288, label: 288, link: 213, code: 213, bullet: 351, border: 109, selected: 109, searchMatch: 351,
|
|
269
|
+
keyword: 351, func: 142, variable: 288, string: 109, number: 109, type: 213,
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
"arnative-gruvbox": {
|
|
273
|
+
// Gruvbox dark: warm canvas #282828 with #3c3836 panels, yellow focus #eebd35 (accent),
|
|
274
|
+
// red headings & model #d83328 (derived from #cc241d, primary), blue-grey footer labels #458588 (secondary),
|
|
275
|
+
// aqua links and code #83a598 (tone).
|
|
276
|
+
accent: "oklch(82% 0.153 88)",
|
|
277
|
+
chroma: 0.15,
|
|
278
|
+
canvasL: 0.25,
|
|
279
|
+
neutralHue: 60,
|
|
280
|
+
neutralChroma: 0.008,
|
|
281
|
+
primary: "oklch(58% 0.203 29)",
|
|
282
|
+
secondary: "oklch(57.6% 0.066 199)",
|
|
283
|
+
tone: "oklch(78% 0.045 170)",
|
|
284
|
+
surfaceMsg: "primary",
|
|
285
|
+
borderAccent: "accentSoft",
|
|
286
|
+
headingColor: "primary",
|
|
287
|
+
linkColor: "tone",
|
|
288
|
+
codeColor: "tone",
|
|
289
|
+
bulletColor: "accent",
|
|
290
|
+
hues: {
|
|
291
|
+
heading: 29, label: 29, link: 170, code: 170, bullet: 88, border: 199, selected: 199, searchMatch: 88,
|
|
292
|
+
keyword: 29, func: 111, variable: 88, string: 83, number: 29, type: 199,
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
"arnative-magical": {
|
|
296
|
+
// Magical: vivid lavender focus (#b892ff, accent), pastel rose/pink headings & model (#ff90b3, primary),
|
|
297
|
+
// deep vivid purple secondary (#6e44ff, secondary), and deep rose-wine panels.
|
|
298
|
+
accent: "oklch(73.9% 0.157 299)",
|
|
299
|
+
chroma: 0.16,
|
|
300
|
+
canvasL: 0.24,
|
|
301
|
+
neutralHue: 300,
|
|
302
|
+
neutralChroma: 0.015,
|
|
303
|
+
primary: "oklch(78.1% 0.139 1)",
|
|
304
|
+
secondary: "oklch(55.5% 0.257 285)",
|
|
305
|
+
tone: "oklch(84% 0.10 320)",
|
|
306
|
+
surfaceMsg: "primary",
|
|
307
|
+
borderAccent: "accentSoft",
|
|
308
|
+
headingColor: "primary",
|
|
309
|
+
linkColor: "tone",
|
|
310
|
+
codeColor: "tone",
|
|
224
311
|
bulletColor: "accent",
|
|
225
312
|
hues: {
|
|
226
|
-
heading:
|
|
227
|
-
keyword:
|
|
313
|
+
heading: 1, label: 1, link: 320, code: 320, bullet: 299, border: 285, selected: 285, searchMatch: 299,
|
|
314
|
+
keyword: 285, func: 1, variable: 299, string: 140, number: 285, type: 320,
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
"arnative-lemonade": {
|
|
318
|
+
// Lemonade: soft sage focus (#aac0aa, accent), warm peach-orange headings & model (#f4b886, primary),
|
|
319
|
+
// bright lime-lemon secondary (#cbe896, secondary), and deep peach-wood panels.
|
|
320
|
+
accent: "oklch(79% 0.06 148)",
|
|
321
|
+
chroma: 0.06,
|
|
322
|
+
canvasL: 0.24,
|
|
323
|
+
neutralHue: 61,
|
|
324
|
+
neutralChroma: 0.012,
|
|
325
|
+
primary: "oklch(82.6% 0.095 61)",
|
|
326
|
+
secondary: "oklch(89.1% 0.11 124)",
|
|
327
|
+
tone: "oklch(85% 0.08 124)",
|
|
328
|
+
surfaceMsg: "primary",
|
|
329
|
+
borderAccent: "accentSoft",
|
|
330
|
+
headingColor: "primary",
|
|
331
|
+
linkColor: "tone",
|
|
332
|
+
codeColor: "tone",
|
|
333
|
+
bulletColor: "accent",
|
|
334
|
+
hues: {
|
|
335
|
+
heading: 61, label: 61, link: 124, code: 124, bullet: 148, border: 124, selected: 124, searchMatch: 148,
|
|
336
|
+
keyword: 148, func: 61, variable: 124, string: 124, number: 61, type: 124,
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
"arnative-blossom": {
|
|
340
|
+
// Blossom: crimson rose focus (#dd2d4a, accent), blossom pink headings & model (#f26a8d, primary),
|
|
341
|
+
// soft petal pink secondary (#ffc2d1, secondary), and deep rose-wine panels.
|
|
342
|
+
accent: "oklch(74% 0.18 18)",
|
|
343
|
+
chroma: 0.18,
|
|
344
|
+
canvasL: 0.24,
|
|
345
|
+
neutralHue: 6,
|
|
346
|
+
neutralChroma: 0.015,
|
|
347
|
+
primary: "oklch(69.9% 0.17 6)",
|
|
348
|
+
secondary: "oklch(87.3% 0.072 2)",
|
|
349
|
+
tone: "oklch(84% 0.10 350)",
|
|
350
|
+
surfaceMsg: "primary",
|
|
351
|
+
borderAccent: "accentSoft",
|
|
352
|
+
headingColor: "primary",
|
|
353
|
+
linkColor: "tone",
|
|
354
|
+
codeColor: "tone",
|
|
355
|
+
bulletColor: "accent",
|
|
356
|
+
hues: {
|
|
357
|
+
heading: 6, label: 6, link: 350, code: 350, bullet: 18, border: 2, selected: 2, searchMatch: 18,
|
|
358
|
+
keyword: 18, func: 6, variable: 18, string: 140, number: 2, type: 350,
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
"arnative-garden": {
|
|
362
|
+
// Garden: warm earth-gold focus (#dda15e, accent), olive-moss headings & model (#6c7844 adapted from #606c38, primary),
|
|
363
|
+
// terracotta secondary (#bc6c25, secondary), and deep forest-earth panels.
|
|
364
|
+
accent: "oklch(75.3% 0.11 68)",
|
|
365
|
+
chroma: 0.11,
|
|
366
|
+
canvasL: 0.24,
|
|
367
|
+
neutralHue: 68,
|
|
368
|
+
neutralChroma: 0.012,
|
|
369
|
+
primary: "oklch(55% 0.076 120)",
|
|
370
|
+
secondary: "oklch(60.9% 0.13 57)",
|
|
371
|
+
tone: "oklch(80% 0.06 120)",
|
|
372
|
+
surfaceMsg: "primary",
|
|
373
|
+
borderAccent: "accentSoft",
|
|
374
|
+
headingColor: "primary",
|
|
375
|
+
linkColor: "tone",
|
|
376
|
+
codeColor: "tone",
|
|
377
|
+
bulletColor: "accent",
|
|
378
|
+
hues: {
|
|
379
|
+
heading: 120, label: 120, link: 120, code: 120, bullet: 68, border: 57, selected: 57, searchMatch: 68,
|
|
380
|
+
keyword: 68, func: 120, variable: 57, string: 140, number: 57, type: 120,
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
"arnative-earthy": {
|
|
384
|
+
// Earthy: warm tan focus (#a68a64, accent), sage-moss headings & model (#6e7653 adapted from #656d4a, primary),
|
|
385
|
+
// clay brown secondary (#7f5539, secondary), and deep forest-earth panels.
|
|
386
|
+
accent: "oklch(76% 0.063 75)",
|
|
387
|
+
chroma: 0.065,
|
|
388
|
+
canvasL: 0.24,
|
|
389
|
+
neutralHue: 75,
|
|
390
|
+
neutralChroma: 0.012,
|
|
391
|
+
primary: "oklch(55% 0.053 119)",
|
|
392
|
+
secondary: "oklch(48.9% 0.07 54)",
|
|
393
|
+
tone: "oklch(78% 0.04 119)",
|
|
394
|
+
surfaceMsg: "primary",
|
|
395
|
+
borderAccent: "accentSoft",
|
|
396
|
+
headingColor: "primary",
|
|
397
|
+
linkColor: "tone",
|
|
398
|
+
codeColor: "tone",
|
|
399
|
+
bulletColor: "accent",
|
|
400
|
+
hues: {
|
|
401
|
+
heading: 119, label: 119, link: 119, code: 119, bullet: 75, border: 54, selected: 54, searchMatch: 75,
|
|
402
|
+
keyword: 75, func: 119, variable: 54, string: 140, number: 54, type: 119,
|
|
228
403
|
},
|
|
229
404
|
},
|
|
230
405
|
};
|
|
@@ -275,8 +450,9 @@ function derive(spec) {
|
|
|
275
450
|
// lib/ansi.ts). One source keeps the declared value and the runtime one identical.
|
|
276
451
|
const accentBorderVal = oklch(0.82, c * 0.6, h);
|
|
277
452
|
const accentVal = oklch(0.78, c, h);
|
|
278
|
-
const
|
|
279
|
-
const
|
|
453
|
+
const accentSoftVal = soften(accentVal);
|
|
454
|
+
const borderAccentRole = spec.borderAccent ?? "accentSoft";
|
|
455
|
+
const borderAccentVal = { accentBorder: accentBorderVal, accentSoft: accentSoftVal, secondary: secondaryVal }[borderAccentRole] ?? borderAccentRole;
|
|
280
456
|
|
|
281
457
|
const vars = {
|
|
282
458
|
fg: oklch(NEUTRAL.fg, nc, nh),
|
|
@@ -285,15 +461,29 @@ function derive(spec) {
|
|
|
285
461
|
fgFaint: oklch(NEUTRAL.fgFaint, nc, nh),
|
|
286
462
|
primary: primaryVal,
|
|
287
463
|
secondary: secondaryVal,
|
|
288
|
-
secondarySoft: soften(
|
|
464
|
+
secondarySoft: soften(secondaryVal),
|
|
289
465
|
accent: accentVal,
|
|
290
|
-
accentSoft:
|
|
466
|
+
accentSoft: accentSoftVal,
|
|
291
467
|
accentBorder: accentBorderVal,
|
|
292
468
|
success: oklch(0.78, Math.min(c, 0.15), sem("success")),
|
|
293
469
|
error: oklch(0.76, Math.min(c, 0.15), sem("error")),
|
|
294
470
|
warning: oklch(0.86, Math.min(c, 0.14), sem("warning")),
|
|
295
|
-
surfaceMsg: spec.surfaceMsg ?? oklch(base, nc * 0.5, nh),
|
|
296
471
|
};
|
|
472
|
+
// Optional third signature tone (a color of its own, reused by roles via its var).
|
|
473
|
+
if (spec.tone) vars.tone = colorLiteral(spec.tone);
|
|
474
|
+
// Optional heading/model signature tone (e.g. cyberpunk's purple), also a var.
|
|
475
|
+
if (spec.headingTone) vars.headingTone = colorLiteral(spec.headingTone);
|
|
476
|
+
|
|
477
|
+
// The message panel: a literal/hex override, or the name of a var whose hue is
|
|
478
|
+
// darkened to a stealth dark level (L:19%) — so a theme can reuse an existing signature var
|
|
479
|
+
// instead of hand-picking a color. Defaults to the neutral canvas tint.
|
|
480
|
+
if (typeof spec.surfaceMsg === "string" && spec.surfaceMsg in vars) {
|
|
481
|
+
const src = parseOklch(vars[spec.surfaceMsg]);
|
|
482
|
+
assert(src !== null, `surfaceMsg var must be an oklch color: ${spec.surfaceMsg}`);
|
|
483
|
+
vars.surfaceMsg = oklch(0.19, Math.min(src.C * 0.35, 0.05), src.H);
|
|
484
|
+
} else {
|
|
485
|
+
vars.surfaceMsg = spec.surfaceMsg ?? oklch(0.19, nc * 0.5, nh);
|
|
486
|
+
}
|
|
297
487
|
|
|
298
488
|
const accentLiteral = oklch(0.8, Math.min(c * 0.7, 0.14), h);
|
|
299
489
|
const roles = {
|
|
@@ -334,7 +524,7 @@ function derive(spec) {
|
|
|
334
524
|
mdCodeBlockBorder: "fgMuted",
|
|
335
525
|
mdQuote: "fgMuted",
|
|
336
526
|
mdQuoteBorder: "fgMuted",
|
|
337
|
-
mdHr: "fgFaint",
|
|
527
|
+
mdHr: spec.hrColor ?? "fgFaint",
|
|
338
528
|
mdListBullet: spec.bulletColor ?? accentLiteral,
|
|
339
529
|
|
|
340
530
|
toolDiffAdded: "success",
|
|
@@ -351,7 +541,7 @@ function derive(spec) {
|
|
|
351
541
|
syntaxOperator: "fg",
|
|
352
542
|
syntaxPunctuation: "fgMuted",
|
|
353
543
|
|
|
354
|
-
thinkingOff: oklch(THINKING.off, nc, nh),
|
|
544
|
+
thinkingOff: oklch(spec.thinkingOff ?? THINKING.off, nc, nh),
|
|
355
545
|
thinkingMinimal: oklch(THINKING.minimal, c * 0.25, h),
|
|
356
546
|
thinkingLow: oklch(THINKING.low, c * 0.4, h),
|
|
357
547
|
thinkingMedium: oklch(THINKING.medium, c * 0.6, h),
|
|
@@ -390,6 +580,58 @@ function derive(spec) {
|
|
|
390
580
|
return { vars, roles, exp };
|
|
391
581
|
}
|
|
392
582
|
|
|
583
|
+
// --- dual-tone guard -------------------------------------------------------
|
|
584
|
+
|
|
585
|
+
/** Hues between two colours, 0..180. */
|
|
586
|
+
const hueGap = (a, b) => {
|
|
587
|
+
const d = Math.abs(hue(a) - hue(b)) % 360;
|
|
588
|
+
return d > 180 ? 360 - d : d;
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
/** How far the label tier must sit from the accent. Every theme draws the footer, the
|
|
592
|
+
* selected row and the detail line on `borderAccent`; when that shares the accent's hue
|
|
593
|
+
* the whole UI reads as one colour, which is how six themes ended up mono-tone. */
|
|
594
|
+
const MIN_HUE_GAP = { default: 25, "arnative": 0, "arnative-cyberpunk": 0, "arnative-crimson": 0, "arnative-matrix": 0, "arnative-neutral": 0, "arnative-gruvbox": 0, "arnative-nord": 0, "arnative-zinc": 0, "arnative-magical": 0, "arnative-lemonade": 0, "arnative-blossom": 0, "arnative-garden": 0, "arnative-earthy": 0 };
|
|
595
|
+
|
|
596
|
+
function assertDualTone(name, { vars, roles, exp }) {
|
|
597
|
+
const accent = parseOklch(vars.accent);
|
|
598
|
+
const labelValue = roles.borderAccent in vars ? vars[roles.borderAccent] : roles.borderAccent;
|
|
599
|
+
const label = parseOklch(String(labelValue));
|
|
600
|
+
assert(accent !== null && label !== null, `${name}: accent and borderAccent must both be oklch`);
|
|
601
|
+
const min = MIN_HUE_GAP[name] ?? MIN_HUE_GAP.default;
|
|
602
|
+
const gap = hueGap(accent.H, label.H);
|
|
603
|
+
assert(
|
|
604
|
+
gap >= min,
|
|
605
|
+
`${name}: accent ${Math.round(accent.H)} and borderAccent ${Math.round(label.H)} are ${gap.toFixed(0)}° apart, need ${min}°`,
|
|
606
|
+
);
|
|
607
|
+
// A label tier without chroma is grey text, not a second tone.
|
|
608
|
+
const minChroma = name === "arnative-neutral" || name === "arnative-zinc" ? 0.01 : 0.02;
|
|
609
|
+
assert(label.C >= minChroma, `${name}: borderAccent chroma ${label.C} is too low to read as a tone`);
|
|
610
|
+
// And it has to stand off the canvas it is drawn on.
|
|
611
|
+
const ratio = contrast(toHex(labelValue), toHex(exp.pageBg));
|
|
612
|
+
assert(ratio >= 3, `${name}: borderAccent contrast ${ratio.toFixed(2)} on pageBg is too low`);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
// --- cross-theme distinctness ----------------------------------------------
|
|
616
|
+
|
|
617
|
+
/** Two themes may not share a signature colour: the picker previews one at a time, so a
|
|
618
|
+
* repeated accent or footer tier makes two palettes look like the same theme. */
|
|
619
|
+
function assertDistinctThemes(themes) {
|
|
620
|
+
const seen = new Map();
|
|
621
|
+
for (const [name, { vars, roles }] of themes) {
|
|
622
|
+
const label = roles.borderAccent in vars ? vars[roles.borderAccent] : roles.borderAccent;
|
|
623
|
+
for (const [tier, value] of [
|
|
624
|
+
["accent", vars.accent],
|
|
625
|
+
["borderAccent", label],
|
|
626
|
+
]) {
|
|
627
|
+
const hex = toHex(value);
|
|
628
|
+
const other = seen.get(hex);
|
|
629
|
+
assert(other === undefined, `${name}.${tier} ${hex} repeats ${other}`);
|
|
630
|
+
seen.set(hex, `${name}.${tier}`);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
393
635
|
// --- rendering -------------------------------------------------------------
|
|
394
636
|
|
|
395
637
|
function render(name, { vars, roles, exp }) {
|
|
@@ -420,8 +662,12 @@ function render(name, { vars, roles, exp }) {
|
|
|
420
662
|
|
|
421
663
|
const check = process.argv.includes("--check");
|
|
422
664
|
let drifted = 0;
|
|
665
|
+
const built = new Map();
|
|
423
666
|
for (const [name, spec] of Object.entries(THEMES)) {
|
|
424
|
-
const
|
|
667
|
+
const derived = derive({ ...spec, name });
|
|
668
|
+
assertDualTone(name, derived);
|
|
669
|
+
built.set(name, derived);
|
|
670
|
+
const content = render(name, derived);
|
|
425
671
|
const file = join(HERE, `${name}.json`);
|
|
426
672
|
if (check) {
|
|
427
673
|
const current = await readFile(file, "utf8").catch(() => "");
|
|
@@ -434,6 +680,7 @@ for (const [name, spec] of Object.entries(THEMES)) {
|
|
|
434
680
|
console.log(`✓ ${name}.json`);
|
|
435
681
|
}
|
|
436
682
|
}
|
|
683
|
+
assertDistinctThemes(built);
|
|
437
684
|
if (check) {
|
|
438
685
|
if (drifted) process.exit(1);
|
|
439
686
|
console.log(`✓ ${Object.keys(THEMES).length} themes in sync with gen-themes.mjs`);
|