@adea-ai/themes 0.11.19 → 0.12.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.
Files changed (192) hide show
  1. package/NOTICE +34 -0
  2. package/README.md +9 -0
  3. package/dist/accents.d.ts.map +1 -1
  4. package/dist/accents.js +10 -2
  5. package/dist/accents.js.map +1 -1
  6. package/dist/adapters/shiki.d.ts.map +1 -1
  7. package/dist/adapters/shiki.js +7 -9
  8. package/dist/adapters/shiki.js.map +1 -1
  9. package/dist/adapters/vscode.d.ts +99 -0
  10. package/dist/adapters/vscode.d.ts.map +1 -0
  11. package/dist/adapters/vscode.js +280 -0
  12. package/dist/adapters/vscode.js.map +1 -0
  13. package/dist/derive.d.ts +10 -5
  14. package/dist/derive.d.ts.map +1 -1
  15. package/dist/derive.js +25 -1
  16. package/dist/derive.js.map +1 -1
  17. package/dist/generated/themes/adea-dark-colorblind.d.ts.map +1 -1
  18. package/dist/generated/themes/adea-dark-colorblind.js +34 -1
  19. package/dist/generated/themes/adea-dark-colorblind.js.map +1 -1
  20. package/dist/generated/themes/adea-dark-high-contrast.d.ts.map +1 -1
  21. package/dist/generated/themes/adea-dark-high-contrast.js +34 -1
  22. package/dist/generated/themes/adea-dark-high-contrast.js.map +1 -1
  23. package/dist/generated/themes/adea-dark.d.ts.map +1 -1
  24. package/dist/generated/themes/adea-dark.js +34 -1
  25. package/dist/generated/themes/adea-dark.js.map +1 -1
  26. package/dist/generated/themes/adea-light-colorblind.d.ts.map +1 -1
  27. package/dist/generated/themes/adea-light-colorblind.js +34 -1
  28. package/dist/generated/themes/adea-light-colorblind.js.map +1 -1
  29. package/dist/generated/themes/adea-light-high-contrast.d.ts.map +1 -1
  30. package/dist/generated/themes/adea-light-high-contrast.js +34 -1
  31. package/dist/generated/themes/adea-light-high-contrast.js.map +1 -1
  32. package/dist/generated/themes/adea-light.d.ts.map +1 -1
  33. package/dist/generated/themes/adea-light.js +34 -1
  34. package/dist/generated/themes/adea-light.js.map +1 -1
  35. package/dist/generated/themes/ayu-light.d.ts.map +1 -1
  36. package/dist/generated/themes/ayu-light.js +34 -1
  37. package/dist/generated/themes/ayu-light.js.map +1 -1
  38. package/dist/generated/themes/ayu-mirage.d.ts.map +1 -1
  39. package/dist/generated/themes/ayu-mirage.js +34 -1
  40. package/dist/generated/themes/ayu-mirage.js.map +1 -1
  41. package/dist/generated/themes/ayu.d.ts.map +1 -1
  42. package/dist/generated/themes/ayu.js +34 -1
  43. package/dist/generated/themes/ayu.js.map +1 -1
  44. package/dist/generated/themes/catppuccin-frappe.d.ts.map +1 -1
  45. package/dist/generated/themes/catppuccin-frappe.js +34 -1
  46. package/dist/generated/themes/catppuccin-frappe.js.map +1 -1
  47. package/dist/generated/themes/catppuccin-latte.d.ts.map +1 -1
  48. package/dist/generated/themes/catppuccin-latte.js +34 -1
  49. package/dist/generated/themes/catppuccin-latte.js.map +1 -1
  50. package/dist/generated/themes/catppuccin-macchiato.d.ts.map +1 -1
  51. package/dist/generated/themes/catppuccin-macchiato.js +34 -1
  52. package/dist/generated/themes/catppuccin-macchiato.js.map +1 -1
  53. package/dist/generated/themes/catppuccin-mocha.d.ts.map +1 -1
  54. package/dist/generated/themes/catppuccin-mocha.js +34 -1
  55. package/dist/generated/themes/catppuccin-mocha.js.map +1 -1
  56. package/dist/generated/themes/dracula.d.ts.map +1 -1
  57. package/dist/generated/themes/dracula.js +34 -1
  58. package/dist/generated/themes/dracula.js.map +1 -1
  59. package/dist/generated/themes/everforest-dark.d.ts.map +1 -1
  60. package/dist/generated/themes/everforest-dark.js +34 -1
  61. package/dist/generated/themes/everforest-dark.js.map +1 -1
  62. package/dist/generated/themes/everforest-light.d.ts.map +1 -1
  63. package/dist/generated/themes/everforest-light.js +34 -1
  64. package/dist/generated/themes/everforest-light.js.map +1 -1
  65. package/dist/generated/themes/gruvbox-dark.d.ts.map +1 -1
  66. package/dist/generated/themes/gruvbox-dark.js +34 -1
  67. package/dist/generated/themes/gruvbox-dark.js.map +1 -1
  68. package/dist/generated/themes/gruvbox-light.d.ts.map +1 -1
  69. package/dist/generated/themes/gruvbox-light.js +34 -1
  70. package/dist/generated/themes/gruvbox-light.js.map +1 -1
  71. package/dist/generated/themes/kanagawa.d.ts.map +1 -1
  72. package/dist/generated/themes/kanagawa.js +34 -1
  73. package/dist/generated/themes/kanagawa.js.map +1 -1
  74. package/dist/generated/themes/monokai.d.ts.map +1 -1
  75. package/dist/generated/themes/monokai.js +34 -1
  76. package/dist/generated/themes/monokai.js.map +1 -1
  77. package/dist/generated/themes/nord.d.ts.map +1 -1
  78. package/dist/generated/themes/nord.js +34 -1
  79. package/dist/generated/themes/nord.js.map +1 -1
  80. package/dist/generated/themes/one-dark.d.ts.map +1 -1
  81. package/dist/generated/themes/one-dark.js +34 -1
  82. package/dist/generated/themes/one-dark.js.map +1 -1
  83. package/dist/generated/themes/rosepine-dawn.d.ts.map +1 -1
  84. package/dist/generated/themes/rosepine-dawn.js +34 -1
  85. package/dist/generated/themes/rosepine-dawn.js.map +1 -1
  86. package/dist/generated/themes/rosepine-moon.d.ts.map +1 -1
  87. package/dist/generated/themes/rosepine-moon.js +34 -1
  88. package/dist/generated/themes/rosepine-moon.js.map +1 -1
  89. package/dist/generated/themes/rosepine.d.ts.map +1 -1
  90. package/dist/generated/themes/rosepine.js +34 -1
  91. package/dist/generated/themes/rosepine.js.map +1 -1
  92. package/dist/generated/themes/solarized-dark.d.ts.map +1 -1
  93. package/dist/generated/themes/solarized-dark.js +34 -1
  94. package/dist/generated/themes/solarized-dark.js.map +1 -1
  95. package/dist/generated/themes/solarized-light.d.ts.map +1 -1
  96. package/dist/generated/themes/solarized-light.js +34 -1
  97. package/dist/generated/themes/solarized-light.js.map +1 -1
  98. package/dist/generated/themes/tokyonight-night.d.ts.map +1 -1
  99. package/dist/generated/themes/tokyonight-night.js +34 -1
  100. package/dist/generated/themes/tokyonight-night.js.map +1 -1
  101. package/dist/generated/themes/tokyonight-storm.d.ts.map +1 -1
  102. package/dist/generated/themes/tokyonight-storm.js +34 -1
  103. package/dist/generated/themes/tokyonight-storm.js.map +1 -1
  104. package/dist/generated/themes/vesper.d.ts.map +1 -1
  105. package/dist/generated/themes/vesper.js +34 -1
  106. package/dist/generated/themes/vesper.js.map +1 -1
  107. package/dist/index.d.ts +4 -2
  108. package/dist/index.d.ts.map +1 -1
  109. package/dist/index.js +2 -1
  110. package/dist/index.js.map +1 -1
  111. package/dist/render.d.ts +4 -0
  112. package/dist/render.d.ts.map +1 -1
  113. package/dist/render.js +10 -5
  114. package/dist/render.js.map +1 -1
  115. package/dist/schema.d.ts +25 -1
  116. package/dist/schema.d.ts.map +1 -1
  117. package/dist/schema.js +35 -0
  118. package/dist/schema.js.map +1 -1
  119. package/dist/sources.d.ts +39 -0
  120. package/dist/sources.d.ts.map +1 -1
  121. package/dist/sources.js +207 -0
  122. package/dist/sources.js.map +1 -1
  123. package/dist/theme-token-projection-script.js +1 -1
  124. package/package.json +7 -1
  125. package/palettes/syntax/adea-dark-colorblind.json +34 -0
  126. package/palettes/syntax/adea-dark-high-contrast.json +34 -0
  127. package/palettes/syntax/adea-dark.json +34 -0
  128. package/palettes/syntax/adea-light-colorblind.json +34 -0
  129. package/palettes/syntax/adea-light-high-contrast.json +34 -0
  130. package/palettes/syntax/adea-light.json +34 -0
  131. package/palettes/syntax/ayu-light.json +34 -0
  132. package/palettes/syntax/ayu-mirage.json +34 -0
  133. package/palettes/syntax/ayu.json +34 -0
  134. package/palettes/syntax/catppuccin-frappe.json +34 -0
  135. package/palettes/syntax/catppuccin-latte.json +34 -0
  136. package/palettes/syntax/catppuccin-macchiato.json +34 -0
  137. package/palettes/syntax/catppuccin-mocha.json +34 -0
  138. package/palettes/syntax/dracula.json +34 -0
  139. package/palettes/syntax/everforest-dark.json +34 -0
  140. package/palettes/syntax/everforest-light.json +34 -0
  141. package/palettes/syntax/gruvbox-dark.json +34 -0
  142. package/palettes/syntax/gruvbox-light.json +34 -0
  143. package/palettes/syntax/kanagawa.json +34 -0
  144. package/palettes/syntax/monokai.json +34 -0
  145. package/palettes/syntax/nord.json +34 -0
  146. package/palettes/syntax/one-dark.json +34 -0
  147. package/palettes/syntax/rosepine-dawn.json +34 -0
  148. package/palettes/syntax/rosepine-moon.json +34 -0
  149. package/palettes/syntax/rosepine.json +34 -0
  150. package/palettes/syntax/solarized-dark.json +34 -0
  151. package/palettes/syntax/solarized-light.json +34 -0
  152. package/palettes/syntax/tokyonight-night.json +34 -0
  153. package/palettes/syntax/tokyonight-storm.json +34 -0
  154. package/palettes/syntax/vesper.json +34 -0
  155. package/src/accents.ts +11 -2
  156. package/src/adapters/shiki.ts +7 -9
  157. package/src/adapters/vscode.ts +319 -0
  158. package/src/derive.ts +36 -24
  159. package/src/generated/themes/adea-dark-colorblind.ts +34 -1
  160. package/src/generated/themes/adea-dark-high-contrast.ts +34 -1
  161. package/src/generated/themes/adea-dark.ts +34 -1
  162. package/src/generated/themes/adea-light-colorblind.ts +34 -1
  163. package/src/generated/themes/adea-light-high-contrast.ts +34 -1
  164. package/src/generated/themes/adea-light.ts +34 -1
  165. package/src/generated/themes/ayu-light.ts +34 -1
  166. package/src/generated/themes/ayu-mirage.ts +34 -1
  167. package/src/generated/themes/ayu.ts +34 -1
  168. package/src/generated/themes/catppuccin-frappe.ts +34 -1
  169. package/src/generated/themes/catppuccin-latte.ts +34 -1
  170. package/src/generated/themes/catppuccin-macchiato.ts +34 -1
  171. package/src/generated/themes/catppuccin-mocha.ts +34 -1
  172. package/src/generated/themes/dracula.ts +34 -1
  173. package/src/generated/themes/everforest-dark.ts +34 -1
  174. package/src/generated/themes/everforest-light.ts +34 -1
  175. package/src/generated/themes/gruvbox-dark.ts +34 -1
  176. package/src/generated/themes/gruvbox-light.ts +34 -1
  177. package/src/generated/themes/kanagawa.ts +34 -1
  178. package/src/generated/themes/monokai.ts +34 -1
  179. package/src/generated/themes/nord.ts +34 -1
  180. package/src/generated/themes/one-dark.ts +34 -1
  181. package/src/generated/themes/rosepine-dawn.ts +34 -1
  182. package/src/generated/themes/rosepine-moon.ts +34 -1
  183. package/src/generated/themes/rosepine.ts +34 -1
  184. package/src/generated/themes/solarized-dark.ts +34 -1
  185. package/src/generated/themes/solarized-light.ts +34 -1
  186. package/src/generated/themes/tokyonight-night.ts +34 -1
  187. package/src/generated/themes/tokyonight-storm.ts +34 -1
  188. package/src/generated/themes/vesper.ts +34 -1
  189. package/src/index.ts +12 -1
  190. package/src/render.ts +16 -5
  191. package/src/schema.ts +55 -1
  192. package/src/sources.ts +247 -0
package/NOTICE CHANGED
@@ -141,6 +141,40 @@ build.
141
141
 
142
142
  ---
143
143
 
144
+ # Syntax colours
145
+
146
+ Syntax colours for a code view come from each theme's own VS Code colour theme,
147
+ not from its terminal palette, so that a theme looks in Adea's editor the way it
148
+ looks in VS Code. `scripts/vendor-syntax.ts` downloads the pinned package VS Code
149
+ installs, from Open VSX (https://open-vsx.org), checks it against the registry's
150
+ published SHA-256, checks it carries an MIT grant, and resolves each syntax role
151
+ from the theme's `tokenColors` with the rules VS Code itself applies. The resolved
152
+ hex values are committed in `palettes/syntax/`, and each catalogue entry records
153
+ the package and its digest on its `syntaxProvenance` field. Nothing is fetched at
154
+ build or run time.
155
+
156
+ | Themes | Editor theme package | Licence |
157
+ | --------------------------------- | ----------------------------------------------- | ------- |
158
+ | Adea (six variants) | GitHub/github-vscode-theme 6.3.5 (primer) | MIT |
159
+ | Ayu, Ayu Mirage, Ayu Light | teabyii/ayu 1.6.0 | MIT |
160
+ | Catppuccin (four flavours) | Catppuccin/catppuccin-vsc 3.19.0 | MIT |
161
+ | Dracula | dracula-theme/theme-dracula 2.25.1 | MIT |
162
+ | Everforest Dark, Light | sainnhe/everforest 0.3.0 | MIT |
163
+ | Gruvbox Dark, Light | jdinhlife/gruvbox 1.29.2 | MIT |
164
+ | Kanagawa | metaphore/kanagawa-vscode-color-theme 0.5.0 | MIT |
165
+ | Monokai, Solarized Dark and Light | Visual Studio Code 1.95.3 built-ins (Microsoft) | MIT |
166
+ | Nord | arcticicestudio/nord-visual-studio-code 0.19.0 | MIT |
167
+ | One Dark | zhuangtongfa/material-theme 3.20.6 (One Dark Pro) | MIT |
168
+ | Rosé Pine, Moon, Dawn | mvllow/rose-pine 2.15.2 | MIT |
169
+ | Tokyo Night Night, Storm | enkia/tokyo-night 1.1.2 | MIT |
170
+ | Vesper | raunofreiberg/vesper 0.0.39 | MIT |
171
+
172
+ Aardvark, Nord Light and Tokyo Night Day have no editor theme of their own
173
+ (Tokyo Night's "Light" VS Code theme is a different palette from Day), and keep
174
+ syntax roles derived from their ANSI colours.
175
+
176
+ ---
177
+
144
178
  # Contrast repairs
145
179
 
146
180
  Some themes in this catalogue do not ship the exact colour a palette specifies for
package/README.md CHANGED
@@ -152,6 +152,7 @@ const prepaintCall = `(${themeTokenProjectionBundle})(tokens, ${serializedRules}
152
152
  | `adapters/shadcn` | this org's components | shadcn token names, mapped from the same data |
153
153
  | `adapters/xterm` | terminals | xterm.js's hex-only `ITheme` |
154
154
  | `adapters/shiki` | code views | a Shiki theme registration |
155
+ | `adapters/vscode` | code views | syntax roles from a VS Code colour theme |
155
156
  | `adapters/base24` | interop | Base24, both directions |
156
157
 
157
158
  One mapping surprises people: Adea's `accent` becomes shadcn's `primary`, because
@@ -193,6 +194,13 @@ hand-authored catalogue would have shipped:
193
194
  functions of the roles a theme does hold (`src/derive.ts`), so two consumers cannot
194
195
  disagree about what colour a keyword is.
195
196
 
197
+ **Code looks the way it does in VS Code.** A theme with a VS Code colour theme of its
198
+ own carries the syntax colours that theme assigns (`syntax`), resolved by
199
+ `adapters/vscode` with VS Code's own TextMate and semantic-token rules from a pinned
200
+ package (`bun run vendor:syntax`, see NOTICE). Picking Dracula paints strings
201
+ `#f1fa8c` and functions `#50fa7b`, as in VS Code. A theme without one derives its
202
+ roles from its ANSI colours.
203
+
196
204
  ### Base24 is a bridge, not the schema
197
205
 
198
206
  Base24 is an excellent interchange format and a poor application schema: it has a
@@ -219,6 +227,7 @@ bun run verify # formatting, typecheck, lint, catalogue freshness, test
219
227
  bun run catalogue:build # regenerate src/generated from palettes/ and sources.ts
220
228
  bun run catalogue:check # fail if the committed catalogue is stale
221
229
  bun run vendor # refresh palettes/ from the pinned upstream revision
230
+ bun run vendor:syntax # refresh palettes/syntax/ from the pinned VS Code themes
222
231
  ```
223
232
 
224
233
  The generated catalogue is committed, and `catalogue:check` fails when it no longer
@@ -1 +1 @@
1
- {"version":3,"file":"accents.d.ts","sourceRoot":"","sources":["../src/accents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAW,qBAAqB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAU7F,OAAO,EACL,iBAAiB,EAKlB,MAAM,aAAa,CAAA;AAIpB,0DAA0D;AAC1D,MAAM,MAAM,YAAY,GAAG;IACzB,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAA;IACnB,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAA;IACb,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,EAAE,SAAS,YAAY,EA2CzC,CAAA;AAEF,mFAAmF;AACnF,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAAsD,CAAA;AAE9F,8BAA8B;AAC9B,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAE9D;AAED,6CAA6C;AAC7C,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,GAAG,MAAM,CAErF;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM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ED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,CAQhG;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,eAAe,GAAG,WAAW,EACrC,eAAe,SAAc,EAC7B,SAAS,GAAE,SAAS,MAAM,EAAO,GAChC,MAAM,CAIR;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AA2ChE;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,YAAY,EAAE,CAgBpF;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,iBAAiB,EAAE,MAAM,CAAA;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,YAAY;AACpB;;;;GAIG;AACH,MAAM,EAAE,eAAe,GAAG,WAAW;AACrC,qFAAqF;AACrF,eAAe,SAAc,GAC5B,WAAW,CAab"}
package/dist/accents.js CHANGED
@@ -62,7 +62,7 @@
62
62
  */
63
63
  import { canonical, contrastDirection, contrastRatio, formatOklch, parseColor, shiftLightness, } from './oklch.js';
64
64
  import { ACCENT_PREFERENCE, CONTRAST_FLOORS, MINIMUM_ACCENT_CHROMA, REPAIR_BUDGET, REPAIR_STEP, } from './policy.js';
65
- import { compositeOver, mostContrasting, renderedColor } from './render.js';
65
+ import { compositeColor, compositePrepared, mostContrasting, renderedColor } from './render.js';
66
66
  import { smallestOffset } from './step-search.js';
67
67
  /**
68
68
  * The presets.
@@ -271,11 +271,19 @@ export function tintCheck(theme, primaries = []) {
271
271
  if (foregrounds.some((value) => value === undefined))
272
272
  return () => false;
273
273
  const tints = [...new Set([...offeredPrimaries(theme), ...primaries])];
274
+ // Every alpha and surface reuses the same opaque sRGB values; resolving them repeatedly
275
+ // dominates the tint search for themes near the contrast floor.
276
+ const colors = new Map();
277
+ const prepared = (value) => {
278
+ if (!colors.has(value))
279
+ colors.set(value, compositeColor(value));
280
+ return colors.get(value);
281
+ };
274
282
  const legibleOn = (fill) => fill !== undefined &&
275
283
  foregrounds.every((foreground) => contrastRatio(foreground, fill) >= CONTRAST_FLOORS.text);
276
284
  return (surface, alpha) => alpha === 0
277
285
  ? legibleOn(renderedColor(surface))
278
- : tints.every((tint) => legibleOn(compositeOver(tint, surface, alpha / 100)));
286
+ : tints.every((tint) => legibleOn(compositePrepared(prepared(tint), prepared(surface), alpha / 100)));
279
287
  }
280
288
  /**
281
289
  * The tint strength a theme can carry, as a whole percentage.
@@ -1 +1 @@
1
- {"version":3,"file":"accents.js","sourceRoot":"","sources":["../src/accents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAIH,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,UAAU,EACV,cAAc,GACf,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,WAAW,GACZ,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAejD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,OAAO,GAA4B,MAAM,CAAC,MAAM,CAAC;IAC5D;QACE,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,QAAQ;QACf,WAAW,EAAE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W,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IAEpD,OAAO;QACL,OAAO;QACP,iBAAiB,EAAE,gBAAgB,CAAC,KAAK,CAAC;QAC1C,YAAY,EAAE,YAAY,CAAC,KAAK,EAAE,UAAU,CAAC;QAC7C,aAAa,EAAE,gBAAgB,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,KAAK,CAAC,CAAC;QACjE,IAAI,EAAE,OAAO;KACd,CAAA;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"shiki.d.ts","sourceRoot":"","sources":["../../src/adapters/shiki.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAK7C;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,QAAQ,EAAE,iBAAiB,EAAE,CAAA;CAC9B;AAED,4CAA4C;AAC5C,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;IAClC,QAAQ,EAAE;QACR,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;CACF;AAkDD,gDAAgD;AAChD,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,sBAAsB,CA6CrE;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,sBAAsB,EAAE,CAEpF"}
1
+ {"version":3,"file":"shiki.d.ts","sourceRoot":"","sources":["../../src/adapters/shiki.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAK7C;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,QAAQ,EAAE,iBAAiB,EAAE,CAAA;CAC9B;AAED,4CAA4C;AAC5C,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;IAClC,QAAQ,EAAE;QACR,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;CACF;AAgDD,gDAAgD;AAChD,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,sBAAsB,CA6CrE;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,sBAAsB,EAAE,CAEpF"}
@@ -41,19 +41,17 @@ import { toHex as hex } from '../render.js';
41
41
  * role unambiguously, and leave the rest to the editor's default.
42
42
  */
43
43
  const SHIKI_SCOPES = Object.freeze({
44
- keyword: [
45
- 'keyword',
46
- 'keyword.control',
47
- 'keyword.operator.new',
48
- 'storage',
49
- 'storage.type',
50
- 'storage.modifier',
51
- ],
44
+ keyword: ['keyword', 'keyword.control', 'keyword.operator.new'],
45
+ storage: ['storage', 'storage.type', 'storage.modifier'],
52
46
  string: ['string', 'string.quoted', 'string.template', 'punctuation.definition.string'],
53
47
  number: ['constant.numeric', 'constant.language', 'constant.other'],
54
48
  comment: ['comment', 'punctuation.definition.comment'],
55
49
  function: ['entity.name.function', 'support.function', 'meta.function-call', 'variable.function'],
56
- variable: ['variable', 'variable.other', 'variable.parameter', 'meta.definition.variable'],
50
+ variable: ['variable', 'variable.other', 'meta.definition.variable'],
51
+ parameter: ['variable.parameter'],
52
+ property: ['meta.object-literal.key', 'support.type.property-name'],
53
+ field: ['variable.object.property', 'meta.definition.property variable'],
54
+ member: ['variable.other.property', 'variable.other.object.property'],
57
55
  type: ['entity.name.type', 'entity.name.class', 'support.type', 'support.class'],
58
56
  tag: ['entity.name.tag', 'meta.tag'],
59
57
  attribute: ['entity.other.attribute-name'],
@@ -1 +1 @@
1
- {"version":3,"file":"shiki.js","sourceRoot":"","sources":["../../src/adapters/shiki.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,KAAK,IAAI,GAAG,EAAE,MAAM,cAAc,CAAA;AAyB3C;;;;;;;;;;;;;;GAcG;AACH,MAAM,YAAY,GAAoD,MAAM,CAAC,MAAM,CAAC;IAClF,OAAO,EAAE;QACP,SAAS;QACT,iBAAiB;QACjB,sBAAsB;QACtB,SAAS;QACT,cAAc;QACd,kBAAkB;KACnB;IACD,MAAM,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,+BAA+B,CAAC;IACvF,MAAM,EAAE,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,gBAAgB,CAAC;IACnE,OAAO,EAAE,CAAC,SAAS,EAAE,gCAAgC,CAAC;IACtD,QAAQ,EAAE,CAAC,sBAAsB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,mBAAmB,CAAC;IACjG,QAAQ,EAAE,CAAC,UAAU,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,0BAA0B,CAAC;IAC1F,IAAI,EAAE,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,eAAe,CAAC;IAChF,GAAG,EAAE,CAAC,iBAAiB,EAAE,UAAU,CAAC;IACpC,SAAS,EAAE,CAAC,6BAA6B,CAAC;IAC1C,OAAO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 /**
2
+ * The editor adapter in the other direction: a VS Code colour theme as syntax roles.
3
+ *
4
+ * A palette's ANSI colours say what its author wanted a terminal to look like.
5
+ * What they wanted *code* to look like is in their editor theme, a VS Code
6
+ * `tokenColors` list of TextMate scope selectors, and that list is the de facto
7
+ * standard every editor theme is published in: Shiki, Zed's importer and most
8
+ * web highlighters read it. Reading the roles from that list, with the rules VS
9
+ * Code itself uses to pick a rule for a token, is what makes a theme picked here
10
+ * look the way it does in VS Code.
11
+ *
12
+ * ## How a role is resolved
13
+ *
14
+ * A role is not a scope, it is a token, so each role names the scope stack a
15
+ * TypeScript grammar gives a representative token of it ({@link ROLE_SCOPES}): an
16
+ * object key is `meta.objectliteral meta.object.member meta.object-literal.key`,
17
+ * a parameter `meta.parameters variable.parameter`. The stack is resolved the way
18
+ * `vscode-textmate` resolves it: each scope, from the outermost in, takes the
19
+ * foreground of the most specific rule that matches it (deepest selector first,
20
+ * then the rule with more matching parent selectors, then the later rule), and a
21
+ * scope no rule colours keeps its parent's colour, down to the theme's default
22
+ * ink.
23
+ *
24
+ * Themes that turn on semantic highlighting are coloured for TypeScript by the
25
+ * language server, not the grammar, for a handful of roles: VS Code reads those
26
+ * from `semanticTokenColors`, or failing that from the scope each semantic token
27
+ * falls back to ({@link SEMANTIC_ROLES}). The same order is applied here, so a
28
+ * theme like Catppuccin, whose object keys are coloured only semantically, keeps
29
+ * them.
30
+ */
31
+ import { type SyntaxRole, type ThemeSyntax } from '../schema.js';
32
+ /** One entry of a VS Code theme's `tokenColors`. */
33
+ export interface VsCodeTokenColor {
34
+ name?: string;
35
+ scope?: string | readonly string[];
36
+ settings?: {
37
+ foreground?: string;
38
+ background?: string;
39
+ fontStyle?: string;
40
+ };
41
+ }
42
+ /** The parts of a VS Code colour theme this adapter reads. */
43
+ export interface VsCodeTheme {
44
+ name?: string;
45
+ type?: string;
46
+ colors?: Readonly<Record<string, string | null | undefined>>;
47
+ tokenColors?: readonly VsCodeTokenColor[];
48
+ semanticHighlighting?: boolean;
49
+ semanticTokenColors?: Readonly<Record<string, string | {
50
+ foreground?: string;
51
+ } | null | undefined>>;
52
+ }
53
+ /**
54
+ * Role → the scope stack of a representative token, outermost first.
55
+ *
56
+ * TypeScript's grammar, because it is the language most of this product's code
57
+ * is in and the one every editor theme is tuned against. The three property roles
58
+ * are three different tokens to that grammar, and some themes colour them apart:
59
+ * Tokyo Night gives object keys a teal and member reads a blue of their own.
60
+ * `searchMatch` has no token: VS Code paints a match as a background, so it
61
+ * stays derived.
62
+ */
63
+ export declare const ROLE_SCOPES: Readonly<Partial<Record<SyntaxRole, readonly string[]>>>;
64
+ /**
65
+ * Roles TypeScript's language server colours when a theme enables semantic
66
+ * highlighting: the `semanticTokenColors` keys VS Code looks up, most specific
67
+ * first, and the TextMate scope it falls back to when the theme names none.
68
+ */
69
+ export declare const SEMANTIC_ROLES: Readonly<Partial<Record<SyntaxRole, {
70
+ keys: readonly string[];
71
+ scope: string;
72
+ }>>>;
73
+ /**
74
+ * The foreground VS Code gives a token with this scope stack (outermost first), or
75
+ * `undefined` when neither a rule nor the theme's default names one.
76
+ */
77
+ export declare function resolveScopeStack(theme: VsCodeTheme, stack: readonly string[], options?: {
78
+ inherit?: boolean;
79
+ }): string | undefined;
80
+ /**
81
+ * A `#rgb[a]`/`#rrggbb[aa]` colour as opaque `#rrggbb`, with any alpha composited
82
+ * over `background` the way an editor paints it.
83
+ */
84
+ export declare function opaqueHex(color: string, background: string | undefined): string;
85
+ /**
86
+ * The syntax roles a VS Code theme assigns, as opaque lowercase hex.
87
+ *
88
+ * Every role with a representative token is returned, including those the theme
89
+ * leaves to its default ink, because the default ink *is* what VS Code draws
90
+ * them in. Only `searchMatch`, which is not a token, is left out.
91
+ */
92
+ export declare function vsCodeSyntax(theme: VsCodeTheme): ThemeSyntax;
93
+ /**
94
+ * Parses a VS Code theme file, which is JSON with comments and trailing commas
95
+ * (VS Code reads every theme as JSONC, and Nord, Tokyo Night and Vesper ship
96
+ * their themes that way).
97
+ */
98
+ export declare function parseVsCodeTheme(text: string): VsCodeTheme;
99
+ //# sourceMappingURL=vscode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vscode.d.ts","sourceRoot":"","sources":["../../src/adapters/vscode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAgB,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAE9E,oDAAoD;AACpD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;IAClC,QAAQ,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC5E;AAED,8DAA8D;AAC9D,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,CAAA;IAC5D,WAAW,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAA;IACzC,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,mBAAmB,CAAC,EAAE,QAAQ,CAC5B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,GAAG,SAAS,CAAC,CACpE,CAAA;CACF;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAuC/E,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CACnC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CASvE,CAAA;AA0FF;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAClC,MAAM,GAAG,SAAS,CAOpB;AA2BD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAS/E;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAU5D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CA6B1D"}
@@ -0,0 +1,280 @@
1
+ /**
2
+ * The editor adapter in the other direction: a VS Code colour theme as syntax roles.
3
+ *
4
+ * A palette's ANSI colours say what its author wanted a terminal to look like.
5
+ * What they wanted *code* to look like is in their editor theme, a VS Code
6
+ * `tokenColors` list of TextMate scope selectors, and that list is the de facto
7
+ * standard every editor theme is published in: Shiki, Zed's importer and most
8
+ * web highlighters read it. Reading the roles from that list, with the rules VS
9
+ * Code itself uses to pick a rule for a token, is what makes a theme picked here
10
+ * look the way it does in VS Code.
11
+ *
12
+ * ## How a role is resolved
13
+ *
14
+ * A role is not a scope, it is a token, so each role names the scope stack a
15
+ * TypeScript grammar gives a representative token of it ({@link ROLE_SCOPES}): an
16
+ * object key is `meta.objectliteral meta.object.member meta.object-literal.key`,
17
+ * a parameter `meta.parameters variable.parameter`. The stack is resolved the way
18
+ * `vscode-textmate` resolves it: each scope, from the outermost in, takes the
19
+ * foreground of the most specific rule that matches it (deepest selector first,
20
+ * then the rule with more matching parent selectors, then the later rule), and a
21
+ * scope no rule colours keeps its parent's colour, down to the theme's default
22
+ * ink.
23
+ *
24
+ * Themes that turn on semantic highlighting are coloured for TypeScript by the
25
+ * language server, not the grammar, for a handful of roles: VS Code reads those
26
+ * from `semanticTokenColors`, or failing that from the scope each semantic token
27
+ * falls back to ({@link SEMANTIC_ROLES}). The same order is applied here, so a
28
+ * theme like Catppuccin, whose object keys are coloured only semantically, keeps
29
+ * them.
30
+ */
31
+ import { SYNTAX_ROLES } from '../schema.js';
32
+ /**
33
+ * Role → the scope stack of a representative token, outermost first.
34
+ *
35
+ * TypeScript's grammar, because it is the language most of this product's code
36
+ * is in and the one every editor theme is tuned against. The three property roles
37
+ * are three different tokens to that grammar, and some themes colour them apart:
38
+ * Tokyo Night gives object keys a teal and member reads a blue of their own.
39
+ * `searchMatch` has no token: VS Code paints a match as a background, so it
40
+ * stays derived.
41
+ */
42
+ export const ROLE_SCOPES = Object.freeze({
43
+ keyword: ['source.ts', 'keyword.control.flow.ts'],
44
+ string: ['source.ts', 'string.quoted.single.ts'],
45
+ number: ['source.ts', 'constant.numeric.decimal.ts'],
46
+ comment: ['source.ts', 'comment.line.double-slash.ts'],
47
+ function: ['source.ts', 'meta.function-call.ts', 'entity.name.function.ts'],
48
+ variable: ['source.ts', 'variable.other.readwrite.ts'],
49
+ parameter: ['source.ts', 'meta.parameters.ts', 'variable.parameter.ts'],
50
+ property: [
51
+ 'source.ts',
52
+ 'meta.objectliteral.ts',
53
+ 'meta.object.member.ts',
54
+ 'meta.object-literal.key.ts',
55
+ ],
56
+ field: [
57
+ 'source.ts',
58
+ 'meta.interface.ts',
59
+ 'meta.field.declaration.ts',
60
+ 'meta.definition.property.ts',
61
+ 'variable.object.property.ts',
62
+ ],
63
+ member: ['source.ts', 'meta.var.expr.ts', 'variable.other.property.ts'],
64
+ storage: ['source.ts', 'meta.var.expr.ts', 'storage.type.ts'],
65
+ type: ['source.ts', 'meta.type.annotation.ts', 'entity.name.type.ts'],
66
+ tag: ['text.html.basic', 'meta.tag.structure.div.start.html', 'entity.name.tag.html'],
67
+ attribute: [
68
+ 'text.html.basic',
69
+ 'meta.tag.structure.div.start.html',
70
+ 'meta.attribute.class.html',
71
+ 'entity.other.attribute-name.html',
72
+ ],
73
+ operator: ['source.ts', 'keyword.operator.assignment.ts'],
74
+ heading: ['text.html.markdown', 'markup.heading.markdown', 'entity.name.section.markdown'],
75
+ link: ['text.html.markdown', 'meta.link.inline.markdown', 'markup.underline.link.markdown'],
76
+ constant: ['source.ts', 'constant.language.boolean.true.ts'],
77
+ punctuation: ['source.ts', 'punctuation.separator.comma.ts'],
78
+ diffAdd: ['source.diff', 'markup.inserted.diff'],
79
+ diffDelete: ['source.diff', 'markup.deleted.diff'],
80
+ diffHunk: ['source.diff', 'meta.diff.range.unified'],
81
+ });
82
+ /**
83
+ * Roles TypeScript's language server colours when a theme enables semantic
84
+ * highlighting: the `semanticTokenColors` keys VS Code looks up, most specific
85
+ * first, and the TextMate scope it falls back to when the theme names none.
86
+ */
87
+ export const SEMANTIC_ROLES = Object.freeze({
88
+ property: { keys: ['property.declaration', 'property'], scope: 'variable.other.property' },
89
+ field: { keys: ['property.declaration', 'property'], scope: 'variable.other.property' },
90
+ member: { keys: ['property'], scope: 'variable.other.property' },
91
+ parameter: { keys: ['parameter.declaration', 'parameter'], scope: 'variable.parameter' },
92
+ variable: { keys: ['variable'], scope: 'variable.other.readwrite' },
93
+ function: { keys: ['function'], scope: 'entity.name.function' },
94
+ type: { keys: ['type'], scope: 'entity.name.type' },
95
+ });
96
+ const HEX = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
97
+ function selectorsOf(scope) {
98
+ if (scope === undefined)
99
+ return [];
100
+ const list = typeof scope === 'string' ? scope.split(',') : scope.flatMap((s) => s.split(','));
101
+ return list.map((selector) => selector.trim()).filter(Boolean);
102
+ }
103
+ /** The theme's rules, one per selector, as `vscode-textmate`'s `parseTheme` reads them. */
104
+ function rulesOf(theme) {
105
+ const rules = [];
106
+ for (const [index, entry] of (theme.tokenColors ?? []).entries()) {
107
+ const foreground = entry.settings?.foreground;
108
+ if (typeof foreground !== 'string' || !HEX.test(foreground))
109
+ continue;
110
+ for (const selector of selectorsOf(entry.scope)) {
111
+ const segments = selector.split(/\s+/).filter((segment) => segment !== '>');
112
+ const scope = segments.pop();
113
+ if (!scope)
114
+ continue;
115
+ rules.push({ scope, parents: segments.toReversed(), foreground, index });
116
+ }
117
+ }
118
+ return rules;
119
+ }
120
+ /** True when `selector` names `scope` or one of its ancestors in the dot hierarchy. */
121
+ function scopeMatches(selector, scope) {
122
+ return scope === selector || scope.startsWith(`${selector}.`);
123
+ }
124
+ /** True when each parent selector matches an enclosing scope, innermost first, in order. */
125
+ function parentsMatch(parents, enclosing) {
126
+ let at = enclosing.length - 1;
127
+ for (const parent of parents) {
128
+ while (at >= 0 && !scopeMatches(parent, enclosing[at]))
129
+ at--;
130
+ if (at < 0)
131
+ return false;
132
+ at--;
133
+ }
134
+ return true;
135
+ }
136
+ function depthOf(scope) {
137
+ return scope.split('.').length;
138
+ }
139
+ /** The foreground of the most specific rule that colours `scope` within `enclosing`. */
140
+ function matchScope(rules, scope, enclosing) {
141
+ let best;
142
+ for (const rule of rules) {
143
+ if (!scopeMatches(rule.scope, scope) || !parentsMatch(rule.parents, enclosing))
144
+ continue;
145
+ if (!best) {
146
+ best = rule;
147
+ continue;
148
+ }
149
+ const depth = depthOf(rule.scope) - depthOf(best.scope);
150
+ const parents = rule.parents.length - best.parents.length;
151
+ if (depth > 0 || (depth === 0 && (parents > 0 || (parents === 0 && rule.index > best.index)))) {
152
+ best = rule;
153
+ }
154
+ }
155
+ return best?.foreground;
156
+ }
157
+ /** The theme's default ink: the scopeless rule's foreground, else `editor.foreground`. */
158
+ function defaultForeground(theme) {
159
+ let found;
160
+ for (const entry of theme.tokenColors ?? []) {
161
+ const foreground = entry.settings?.foreground;
162
+ if (selectorsOf(entry.scope).length === 0 && typeof foreground === 'string') {
163
+ if (HEX.test(foreground))
164
+ found = foreground;
165
+ }
166
+ }
167
+ const editor = theme.colors?.['editor.foreground'];
168
+ return found ?? (typeof editor === 'string' && HEX.test(editor) ? editor : undefined);
169
+ }
170
+ /**
171
+ * The foreground VS Code gives a token with this scope stack (outermost first), or
172
+ * `undefined` when neither a rule nor the theme's default names one.
173
+ */
174
+ export function resolveScopeStack(theme, stack, options = {}) {
175
+ const rules = rulesOf(theme);
176
+ let foreground = options.inherit === false ? undefined : defaultForeground(theme);
177
+ for (const [at, scope] of stack.entries()) {
178
+ foreground = matchScope(rules, scope, stack.slice(0, at)) ?? foreground;
179
+ }
180
+ return foreground;
181
+ }
182
+ function semanticForeground(theme, role) {
183
+ const semantic = SEMANTIC_ROLES[role];
184
+ if (!semantic || theme.semanticHighlighting !== true)
185
+ return undefined;
186
+ // A rule for TypeScript is more specific than the same rule for every language.
187
+ for (const key of semantic.keys.flatMap((name) => [`${name}:typescript`, name])) {
188
+ const entry = theme.semanticTokenColors?.[key];
189
+ const foreground = typeof entry === 'string' ? entry : entry?.foreground;
190
+ if (typeof foreground === 'string' && HEX.test(foreground))
191
+ return foreground;
192
+ }
193
+ // A semantic token's fallback scope is matched on its own, with no grammar
194
+ // scopes around it, and colours the token only when some rule names it.
195
+ return resolveScopeStack(theme, [semantic.scope], { inherit: false });
196
+ }
197
+ function channel(hex, at) {
198
+ return Number.parseInt(hex.slice(at, at + 2), 16);
199
+ }
200
+ function expand(hex) {
201
+ const digits = hex.slice(1);
202
+ return digits.length <= 4
203
+ ? `#${[...digits].map((digit) => digit + digit).join('')}`
204
+ : `#${digits}`;
205
+ }
206
+ /**
207
+ * A `#rgb[a]`/`#rrggbb[aa]` colour as opaque `#rrggbb`, with any alpha composited
208
+ * over `background` the way an editor paints it.
209
+ */
210
+ export function opaqueHex(color, background) {
211
+ const full = expand(color.toLowerCase());
212
+ if (full.length === 7)
213
+ return full;
214
+ const alpha = channel(full, 7) / 255;
215
+ const canvas = background && HEX.test(background) ? expand(background.toLowerCase()) : '#000000';
216
+ const mixed = [1, 3, 5].map((at) => Math.round(channel(full, at) * alpha + channel(canvas, at) * (1 - alpha)));
217
+ return `#${mixed.map((value) => value.toString(16).padStart(2, '0')).join('')}`;
218
+ }
219
+ /**
220
+ * The syntax roles a VS Code theme assigns, as opaque lowercase hex.
221
+ *
222
+ * Every role with a representative token is returned, including those the theme
223
+ * leaves to its default ink, because the default ink *is* what VS Code draws
224
+ * them in. Only `searchMatch`, which is not a token, is left out.
225
+ */
226
+ export function vsCodeSyntax(theme) {
227
+ const background = theme.colors?.['editor.background'] ?? undefined;
228
+ const syntax = {};
229
+ for (const role of SYNTAX_ROLES) {
230
+ const stack = ROLE_SCOPES[role];
231
+ if (!stack)
232
+ continue;
233
+ const foreground = semanticForeground(theme, role) ?? resolveScopeStack(theme, stack);
234
+ if (foreground)
235
+ syntax[role] = opaqueHex(foreground, background);
236
+ }
237
+ return syntax;
238
+ }
239
+ /**
240
+ * Parses a VS Code theme file, which is JSON with comments and trailing commas
241
+ * (VS Code reads every theme as JSONC, and Nord, Tokyo Night and Vesper ship
242
+ * their themes that way).
243
+ */
244
+ export function parseVsCodeTheme(text) {
245
+ let out = '';
246
+ let inString = false;
247
+ for (let at = 0; at < text.length; at++) {
248
+ const char = text[at];
249
+ if (inString) {
250
+ out += char;
251
+ if (char === '\\')
252
+ out += text[++at] ?? '';
253
+ else if (char === '"')
254
+ inString = false;
255
+ continue;
256
+ }
257
+ if (char === '"') {
258
+ inString = true;
259
+ out += char;
260
+ }
261
+ else if (char === '/' && text[at + 1] === '/') {
262
+ while (at < text.length && text[at] !== '\n')
263
+ at++;
264
+ out += '\n';
265
+ }
266
+ else if (char === '/' && text[at + 1] === '*') {
267
+ const end = text.indexOf('*/', at + 2);
268
+ at = end === -1 ? text.length : end + 1;
269
+ }
270
+ else {
271
+ out += char;
272
+ }
273
+ }
274
+ const parsed = JSON.parse(out.replace(/,(\s*[}\]])/g, '$1'));
275
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
276
+ throw new Error('a VS Code theme is a JSON object');
277
+ }
278
+ return parsed;
279
+ }
280
+ //# sourceMappingURL=vscode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vscode.js","sourceRoot":"","sources":["../../src/adapters/vscode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,YAAY,EAAqC,MAAM,cAAc,CAAA;AAqB9E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,WAAW,GAA6D,MAAM,CAAC,MAAM,CAAC;IACjG,OAAO,EAAE,CAAC,WAAW,EAAE,yBAAyB,CAAC;IACjD,MAAM,EAAE,CAAC,WAAW,EAAE,yBAAyB,CAAC;IAChD,MAAM,EAAE,CAAC,WAAW,EAAE,6BAA6B,CAAC;IACpD,OAAO,EAAE,CAAC,WAAW,EAAE,8BAA8B,CAAC;IACtD,QAAQ,EAAE,CAAC,WAAW,EAAE,uBAAuB,EAAE,yBAAyB,CAAC;IAC3E,QAAQ,EAAE,CAAC,WAAW,EAAE,6BAA6B,CAAC;IACtD,SAAS,EAAE,CAAC,WAAW,EAAE,oBAAoB,EAAE,uBAAuB,CAAC;IACvE,QAAQ,EAAE;QACR,WAAW;QACX,uBAAuB;QACvB,uBAAuB;QACvB,4BAA4B;KAC7B;IACD,KAAK,EAAE;QACL,WAAW;QACX,mBAAmB;QACnB,2BAA2B;QAC3B,6BAA6B;QAC7B,6BAA6B;KAC9B;IACD,MAAM,EAAE,CAAC,WAAW,EAAE,kBAAkB,EAAE,4BAA4B,CAAC;IACvE,OAAO,EAAE,CAAC,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,CAAC;IAC7D,IAAI,EAAE,CAAC,WAAW,EAAE,yBAAyB,EAAE,qBAAqB,CAAC;IACrE,GAAG,EAAE,CAAC,iBAAiB,EAAE,mCAAmC,EAAE,sBAAsB,CAAC;IACrF,SAAS,EAAE;QACT,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CAAC"}
package/dist/derive.d.ts CHANGED
@@ -28,11 +28,16 @@
28
28
  * has. It is the reasoning that makes `ls --color` readable in each of these
29
29
  * palettes today.
30
30
  */
31
- import type { AdeaTheme } from './schema.js';
32
- /** The syntax roles, matching the names Shiki's theme contract expects. */
33
- export type SyntaxRole = 'keyword' | 'string' | 'number' | 'comment' | 'function' | 'variable' | 'type' | 'tag' | 'attribute' | 'operator' | 'heading' | 'link' | 'constant' | 'punctuation' | 'diffAdd' | 'diffDelete' | 'diffHunk' | 'searchMatch';
34
- /** Roles in the product's editor palette, which are all read as small text. */
35
- export type EditorRole = Exclude<SyntaxRole, 'constant' | 'punctuation'>;
31
+ import type { AdeaTheme, SyntaxRole } from './schema.js';
32
+ export type { SyntaxRole } from './schema.js';
33
+ /**
34
+ * Roles in the product's editor palette, which are all read as small text.
35
+ *
36
+ * Every syntax role: `constant` and `punctuation` joined it when the editor
37
+ * started painting from the theme's own editor theme, where `true` and a comma
38
+ * are each given a colour of their own.
39
+ */
40
+ export type EditorRole = SyntaxRole;
36
41
  /**
37
42
  * The syntax palette for a theme, as OKLCH strings.
38
43
  *