@adea-ai/themes 0.7.0 → 0.7.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.
@@ -1 +1 @@
1
- {"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../src/derive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAI5C,2EAA2E;AAC3E,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,UAAU,GACV,UAAU,GACV,MAAM,GACN,KAAK,GACL,WAAW,GACX,UAAU,GACV,SAAS,GACT,MAAM,GACN,UAAU,GACV,aAAa,GACb,SAAS,GACT,YAAY,GACZ,UAAU,GACV,aAAa,CAAA;AAEjB,+EAA+E;AAC/E,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,aAAa,CAAC,CAAA;AAkDxE;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,EAChB,OAAO,GAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAO,GACtC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAgC5B;AAED,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAQ3E;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAiC3E;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,CAAC,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC,EAOlD,CAAA;AAEX,sDAAsD;AACtD,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,MAAM,EAAE,CA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GAAG,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAQ3E;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAwC3E;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,CAAC,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC,EAOlD,CAAA;AAEX,sDAAsD;AACtD,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,MAAM,EAAE,CAE/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAO,GAAG,MAAM,CAK7E;AAED,qEAAqE;AACrE,eAAO,MAAM,YAAY,kDAAmD,CAAA;AAC5E,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAEtD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAS3E;AAED,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAG9E"}
package/dist/derive.js CHANGED
@@ -47,6 +47,24 @@ const EDITOR_ROLES = [
47
47
  'diffHunk',
48
48
  'searchMatch',
49
49
  ];
50
+ /**
51
+ * Light themes read the two default-ink roles from the dark end of the palette
52
+ * instead.
53
+ *
54
+ * `variable` and `operator` mean "the ink most of the code is drawn in", and ANSI
55
+ * `white` is that slot *on a dark terminal* — a light grey against a dark canvas.
56
+ * On a light theme the same slot is the terminal's brightest colour, at or near
57
+ * the paper itself, so the mapping hands the editor a foreground it cannot draw
58
+ * with: `editorRolesHex`'s bounded repair could not reach 4.5:1 from a chroma-less
59
+ * near-white within its lightness budget, and every community light theme threw.
60
+ * ANSI `black` is the same "default ink" slot from the paper's side of the
61
+ * palette — dark by construction, and it keeps each palette's own tint
62
+ * (Solarized Light's variables stay dark teal, not a repaired grey).
63
+ */
64
+ const LIGHT_SYNTAX_SOURCE = Object.freeze({
65
+ variable: 'black',
66
+ operator: 'black',
67
+ });
50
68
  /** Which ANSI role each syntax role is read from, and why. */
51
69
  const SYNTAX_SOURCE = Object.freeze({
52
70
  // Magenta is the slot palettes spend on the most distinctive hue they have, and
@@ -99,7 +117,8 @@ export function syntaxRoles(theme, options = {}) {
99
117
  const floor = options.commentFloor ?? 2;
100
118
  const roles = {};
101
119
  for (const [role, source] of Object.entries(SYNTAX_SOURCE)) {
102
- const value = parseColor(theme.ansi[source]);
120
+ const slot = theme.appearance === 'light' ? (LIGHT_SYNTAX_SOURCE[role] ?? source) : source;
121
+ const value = parseColor(theme.ansi[slot]);
103
122
  if (!value)
104
123
  continue;
105
124
  if (role === 'comment' || role === 'punctuation') {
@@ -143,8 +162,15 @@ export function editorRolesHex(theme) {
143
162
  // 4.5:1 in OKLCH can round to a hex value just below that floor, so advance
144
163
  // the requested threshold by the smallest measured step until the encoded
145
164
  // value itself clears 4.5:1. No source palette value or hue is rewritten.
165
+ //
166
+ // The projection runs with a wider lightness budget than the default repair,
167
+ // because a light theme's brightest ANSI slots start near the paper: a
168
+ // pastel yellow `number` has more lightness between it and 4.5:1 than the
169
+ // default budget allows, and this projection's contract is to hold the role
170
+ // to AA however far the lightness has to travel — darkening a chromatic
171
+ // colour keeps its hue, so the number stays yellow, just amber.
146
172
  for (let margin = 0.001; margin <= 0.05; margin += 0.001) {
147
- const repaired = repairContrast(source, background, 4.5 + margin);
173
+ const repaired = repairContrast(source, background, 4.5 + margin, 0.55);
148
174
  if (!repaired.satisfied)
149
175
  continue;
150
176
  const candidate = oklchToHex(repaired.color);
@@ -1 +1 @@
1
- {"version":3,"file":"derive.js","sourceRoot":"","sources":["../src/derive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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E,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IAC3C,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IACtD,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IACtD,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU;QAAE,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,CAAA;IAEvE,MAAM,IAAI,GACR,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAA;IAC9F,OAAO,WAAW,CAAC,IAAI,CAAC,CAAA;AAC1B,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,mBAAmB,CAAC,KAAgB,EAAE,IAAgB;IACpE,MAAM,MAAM,GAAG,UAAU,CAAC,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;IACxD,OAAO,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAA;AAC9D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/themes",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "The Adea theme catalogue: first-party and imported semantic OKLCH themes, with Base24, terminal, CSS and syntax adapters.",
5
5
  "keywords": [
6
6
  "adea",
package/src/derive.ts CHANGED
@@ -76,6 +76,26 @@ const EDITOR_ROLES = [
76
76
  'searchMatch',
77
77
  ] as const satisfies readonly EditorRole[]
78
78
 
79
+ /**
80
+ * Light themes read the two default-ink roles from the dark end of the palette
81
+ * instead.
82
+ *
83
+ * `variable` and `operator` mean "the ink most of the code is drawn in", and ANSI
84
+ * `white` is that slot *on a dark terminal* — a light grey against a dark canvas.
85
+ * On a light theme the same slot is the terminal's brightest colour, at or near
86
+ * the paper itself, so the mapping hands the editor a foreground it cannot draw
87
+ * with: `editorRolesHex`'s bounded repair could not reach 4.5:1 from a chroma-less
88
+ * near-white within its lightness budget, and every community light theme threw.
89
+ * ANSI `black` is the same "default ink" slot from the paper's side of the
90
+ * palette — dark by construction, and it keeps each palette's own tint
91
+ * (Solarized Light's variables stay dark teal, not a repaired grey).
92
+ */
93
+ const LIGHT_SYNTAX_SOURCE: Readonly<Partial<Record<SyntaxRole, keyof AdeaTheme['ansi']>>> =
94
+ Object.freeze({
95
+ variable: 'black',
96
+ operator: 'black',
97
+ })
98
+
79
99
  /** Which ANSI role each syntax role is read from, and why. */
80
100
  const SYNTAX_SOURCE: Readonly<Record<SyntaxRole, keyof AdeaTheme['ansi']>> = Object.freeze({
81
101
  // Magenta is the slot palettes spend on the most distinctive hue they have, and
@@ -136,7 +156,8 @@ export function syntaxRoles(
136
156
  SyntaxRole,
137
157
  keyof AdeaTheme['ansi'],
138
158
  ][]) {
139
- const value: Oklch | undefined = parseColor(theme.ansi[source])
159
+ const slot = theme.appearance === 'light' ? (LIGHT_SYNTAX_SOURCE[role] ?? source) : source
160
+ const value: Oklch | undefined = parseColor(theme.ansi[slot])
140
161
  if (!value) continue
141
162
 
142
163
  if (role === 'comment' || role === 'punctuation') {
@@ -188,8 +209,15 @@ export function editorRolesHex(theme: AdeaTheme): Record<EditorRole, string> {
188
209
  // 4.5:1 in OKLCH can round to a hex value just below that floor, so advance
189
210
  // the requested threshold by the smallest measured step until the encoded
190
211
  // value itself clears 4.5:1. No source palette value or hue is rewritten.
212
+ //
213
+ // The projection runs with a wider lightness budget than the default repair,
214
+ // because a light theme's brightest ANSI slots start near the paper: a
215
+ // pastel yellow `number` has more lightness between it and 4.5:1 than the
216
+ // default budget allows, and this projection's contract is to hold the role
217
+ // to AA however far the lightness has to travel — darkening a chromatic
218
+ // colour keeps its hue, so the number stays yellow, just amber.
191
219
  for (let margin = 0.001; margin <= 0.05; margin += 0.001) {
192
- const repaired = repairContrast(source, background, 4.5 + margin)
220
+ const repaired = repairContrast(source, background, 4.5 + margin, 0.55)
193
221
  if (!repaired.satisfied) continue
194
222
  const candidate = oklchToHex(repaired.color)
195
223
  const renderedCandidate = parseColor(candidate)