@filipgutica/design-system 1.0.16 → 1.0.17

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 CHANGED
@@ -38,7 +38,7 @@ npm install @filipgutica/design-system
38
38
  | `@filipgutica/design-system` | `tokens` (resolved values per theme and mode) and `cssVar(name)`, with types. |
39
39
  | `@filipgutica/design-system/tokens.json` | The resolved values as JSON. |
40
40
  | `@filipgutica/design-system/language/*` | The spec, catalogue, and example pages. |
41
- | `@filipgutica/design-system/theme-mapper` | Experimental: the API may change until a component library uses it. `mapVsCodeTheme(theme)` maps a VS Code colour theme onto theme inputs for its one mode, by selecting the theme's own colours, and lists each check it still fails as a `theme` or `core` problem. `themeVariables(mapped)` returns the CSS custom properties to set inline on `<html>`, with `data-theme` forced to the theme's mode. Typed, with no framework and no runtime dependencies. |
41
+ | `@filipgutica/design-system/theme-mapper` | Experimental: the API may change until a component library uses it. `mapVsCodeTheme(theme)` maps a VS Code colour theme onto theme inputs for its one mode, by selecting the theme's own colours, keeps the syntax colours its `tokenColors` set, and lists each check it still fails as a `theme` or `core` problem. `themeVariables(mapped)` returns the CSS custom properties to set inline on `<html>`, with `data-theme` forced to the theme's mode. Typed, with no framework and no runtime dependencies. |
42
42
 
43
43
  In a React app, import `tokens.css` and `fonts.css` once in the entry and write `var(--color-text)` in styles, or `cssVar('color-text')` in TypeScript. `tests/react-smoke/` is a working example.
44
44
 
package/dist/tokens.d.ts CHANGED
@@ -55,6 +55,13 @@ export type TokenName =
55
55
  | 'color-syntax-string'
56
56
  | 'color-syntax-number'
57
57
  | 'color-syntax-comment'
58
+ | 'color-syntax-function'
59
+ | 'color-syntax-type'
60
+ | 'color-syntax-variable'
61
+ | 'color-syntax-operator'
62
+ | 'color-syntax-punctuation'
63
+ | 'color-syntax-tag'
64
+ | 'color-syntax-attribute'
58
65
  | 'text-xs'
59
66
  | 'text-sm'
60
67
  | 'text-md'
package/dist/tokens.js CHANGED
@@ -57,6 +57,13 @@ export const tokens = {
57
57
  "color-syntax-string": "#346347",
58
58
  "color-syntax-number": "#86532e",
59
59
  "color-syntax-comment": "#626772",
60
+ "color-syntax-function": "#715b42",
61
+ "color-syntax-type": "#86532e",
62
+ "color-syntax-variable": "#101315",
63
+ "color-syntax-operator": "#50575e",
64
+ "color-syntax-punctuation": "#50575e",
65
+ "color-syntax-tag": "#715b42",
66
+ "color-syntax-attribute": "#86532e",
60
67
  "text-xs": "0.75rem",
61
68
  "text-sm": "0.8125rem",
62
69
  "text-md": "0.875rem",
@@ -164,6 +171,13 @@ export const tokens = {
164
171
  "color-syntax-string": "#a8bd9c",
165
172
  "color-syntax-number": "#d5b98c",
166
173
  "color-syntax-comment": "#a0a6b1",
174
+ "color-syntax-function": "#d8c2a5",
175
+ "color-syntax-type": "#d5b98c",
176
+ "color-syntax-variable": "#e6e9eb",
177
+ "color-syntax-operator": "#9aa3ab",
178
+ "color-syntax-punctuation": "#9aa3ab",
179
+ "color-syntax-tag": "#d8c2a5",
180
+ "color-syntax-attribute": "#d5b98c",
167
181
  "text-xs": "0.75rem",
168
182
  "text-sm": "0.8125rem",
169
183
  "text-md": "0.875rem",
@@ -273,6 +287,13 @@ export const tokens = {
273
287
  "color-syntax-string": "#346347",
274
288
  "color-syntax-number": "#86532e",
275
289
  "color-syntax-comment": "#626772",
290
+ "color-syntax-function": "#715b42",
291
+ "color-syntax-type": "#86532e",
292
+ "color-syntax-variable": "#4c4f69",
293
+ "color-syntax-operator": "#5c5f77",
294
+ "color-syntax-punctuation": "#5c5f77",
295
+ "color-syntax-tag": "#715b42",
296
+ "color-syntax-attribute": "#86532e",
276
297
  "text-xs": "0.75rem",
277
298
  "text-sm": "0.8125rem",
278
299
  "text-md": "0.875rem",
@@ -380,6 +401,13 @@ export const tokens = {
380
401
  "color-syntax-string": "#a8bd9c",
381
402
  "color-syntax-number": "#d5b98c",
382
403
  "color-syntax-comment": "#a0a6b1",
404
+ "color-syntax-function": "#d8c2a5",
405
+ "color-syntax-type": "#d5b98c",
406
+ "color-syntax-variable": "#cdd6f4",
407
+ "color-syntax-operator": "#a6adc8",
408
+ "color-syntax-punctuation": "#a6adc8",
409
+ "color-syntax-tag": "#d8c2a5",
410
+ "color-syntax-attribute": "#d5b98c",
383
411
  "text-xs": "0.75rem",
384
412
  "text-sm": "0.8125rem",
385
413
  "text-md": "0.875rem",
@@ -489,6 +517,13 @@ export const tokens = {
489
517
  "color-syntax-string": "#346347",
490
518
  "color-syntax-number": "#86532e",
491
519
  "color-syntax-comment": "#626772",
520
+ "color-syntax-function": "#715b42",
521
+ "color-syntax-type": "#86532e",
522
+ "color-syntax-variable": "#101315",
523
+ "color-syntax-operator": "#50575e",
524
+ "color-syntax-punctuation": "#50575e",
525
+ "color-syntax-tag": "#715b42",
526
+ "color-syntax-attribute": "#86532e",
492
527
  "text-xs": "0.75rem",
493
528
  "text-sm": "0.8125rem",
494
529
  "text-md": "0.875rem",
@@ -596,6 +631,13 @@ export const tokens = {
596
631
  "color-syntax-string": "#a8bd9c",
597
632
  "color-syntax-number": "#d5b98c",
598
633
  "color-syntax-comment": "#a0a6b1",
634
+ "color-syntax-function": "#d8c2a5",
635
+ "color-syntax-type": "#d5b98c",
636
+ "color-syntax-variable": "#e6e9eb",
637
+ "color-syntax-operator": "#9aa3ab",
638
+ "color-syntax-punctuation": "#9aa3ab",
639
+ "color-syntax-tag": "#d8c2a5",
640
+ "color-syntax-attribute": "#d5b98c",
599
641
  "text-xs": "0.75rem",
600
642
  "text-sm": "0.8125rem",
601
643
  "text-md": "0.875rem",
@@ -705,6 +747,13 @@ export const tokens = {
705
747
  "color-syntax-string": "#346347",
706
748
  "color-syntax-number": "#86532e",
707
749
  "color-syntax-comment": "#626772",
750
+ "color-syntax-function": "#715b42",
751
+ "color-syntax-type": "#86532e",
752
+ "color-syntax-variable": "#101315",
753
+ "color-syntax-operator": "#50575e",
754
+ "color-syntax-punctuation": "#50575e",
755
+ "color-syntax-tag": "#715b42",
756
+ "color-syntax-attribute": "#86532e",
708
757
  "text-xs": "0.75rem",
709
758
  "text-sm": "0.8125rem",
710
759
  "text-md": "0.875rem",
@@ -812,6 +861,13 @@ export const tokens = {
812
861
  "color-syntax-string": "#a8bd9c",
813
862
  "color-syntax-number": "#d5b98c",
814
863
  "color-syntax-comment": "#a0a6b1",
864
+ "color-syntax-function": "#d8c2a5",
865
+ "color-syntax-type": "#d5b98c",
866
+ "color-syntax-variable": "#e6e9eb",
867
+ "color-syntax-operator": "#9aa3ab",
868
+ "color-syntax-punctuation": "#9aa3ab",
869
+ "color-syntax-tag": "#d8c2a5",
870
+ "color-syntax-attribute": "#d5b98c",
815
871
  "text-xs": "0.75rem",
816
872
  "text-sm": "0.8125rem",
817
873
  "text-md": "0.875rem",
@@ -921,6 +977,13 @@ export const tokens = {
921
977
  "color-syntax-string": "#346347",
922
978
  "color-syntax-number": "#86532e",
923
979
  "color-syntax-comment": "#626772",
980
+ "color-syntax-function": "#715b42",
981
+ "color-syntax-type": "#86532e",
982
+ "color-syntax-variable": "#1f2328",
983
+ "color-syntax-operator": "#59636e",
984
+ "color-syntax-punctuation": "#59636e",
985
+ "color-syntax-tag": "#715b42",
986
+ "color-syntax-attribute": "#86532e",
924
987
  "text-xs": "0.75rem",
925
988
  "text-sm": "0.8125rem",
926
989
  "text-md": "0.875rem",
@@ -1028,6 +1091,13 @@ export const tokens = {
1028
1091
  "color-syntax-string": "#a8bd9c",
1029
1092
  "color-syntax-number": "#d5b98c",
1030
1093
  "color-syntax-comment": "#a0a6b1",
1094
+ "color-syntax-function": "#d8c2a5",
1095
+ "color-syntax-type": "#d5b98c",
1096
+ "color-syntax-variable": "#f0f6fc",
1097
+ "color-syntax-operator": "#9198a1",
1098
+ "color-syntax-punctuation": "#9198a1",
1099
+ "color-syntax-tag": "#d8c2a5",
1100
+ "color-syntax-attribute": "#d5b98c",
1031
1101
  "text-xs": "0.75rem",
1032
1102
  "text-sm": "0.8125rem",
1033
1103
  "text-md": "0.875rem",
@@ -1137,6 +1207,13 @@ export const tokens = {
1137
1207
  "color-syntax-string": "#346347",
1138
1208
  "color-syntax-number": "#86532e",
1139
1209
  "color-syntax-comment": "#626772",
1210
+ "color-syntax-function": "#715b42",
1211
+ "color-syntax-type": "#86532e",
1212
+ "color-syntax-variable": "#101315",
1213
+ "color-syntax-operator": "#50575e",
1214
+ "color-syntax-punctuation": "#50575e",
1215
+ "color-syntax-tag": "#715b42",
1216
+ "color-syntax-attribute": "#86532e",
1140
1217
  "text-xs": "0.75rem",
1141
1218
  "text-sm": "0.8125rem",
1142
1219
  "text-md": "0.875rem",
@@ -1244,6 +1321,13 @@ export const tokens = {
1244
1321
  "color-syntax-string": "#a8bd9c",
1245
1322
  "color-syntax-number": "#d5b98c",
1246
1323
  "color-syntax-comment": "#a0a6b1",
1324
+ "color-syntax-function": "#d8c2a5",
1325
+ "color-syntax-type": "#d5b98c",
1326
+ "color-syntax-variable": "#e6e9eb",
1327
+ "color-syntax-operator": "#9aa3ab",
1328
+ "color-syntax-punctuation": "#9aa3ab",
1329
+ "color-syntax-tag": "#d8c2a5",
1330
+ "color-syntax-attribute": "#d5b98c",
1247
1331
  "text-xs": "0.75rem",
1248
1332
  "text-sm": "0.8125rem",
1249
1333
  "text-md": "0.875rem",
@@ -1353,6 +1437,13 @@ export const tokens = {
1353
1437
  "color-syntax-string": "#346347",
1354
1438
  "color-syntax-number": "#86532e",
1355
1439
  "color-syntax-comment": "#626772",
1440
+ "color-syntax-function": "#715b42",
1441
+ "color-syntax-type": "#86532e",
1442
+ "color-syntax-variable": "#101315",
1443
+ "color-syntax-operator": "#50575e",
1444
+ "color-syntax-punctuation": "#50575e",
1445
+ "color-syntax-tag": "#715b42",
1446
+ "color-syntax-attribute": "#86532e",
1356
1447
  "text-xs": "0.75rem",
1357
1448
  "text-sm": "0.8125rem",
1358
1449
  "text-md": "0.875rem",
@@ -1460,6 +1551,13 @@ export const tokens = {
1460
1551
  "color-syntax-string": "#a8bd9c",
1461
1552
  "color-syntax-number": "#d5b98c",
1462
1553
  "color-syntax-comment": "#a0a6b1",
1554
+ "color-syntax-function": "#d8c2a5",
1555
+ "color-syntax-type": "#d5b98c",
1556
+ "color-syntax-variable": "#e6e9eb",
1557
+ "color-syntax-operator": "#9aa3ab",
1558
+ "color-syntax-punctuation": "#9aa3ab",
1559
+ "color-syntax-tag": "#d8c2a5",
1560
+ "color-syntax-attribute": "#d5b98c",
1463
1561
  "text-xs": "0.75rem",
1464
1562
  "text-sm": "0.8125rem",
1465
1563
  "text-md": "0.875rem",
@@ -1569,6 +1667,13 @@ export const tokens = {
1569
1667
  "color-syntax-string": "#346347",
1570
1668
  "color-syntax-number": "#86532e",
1571
1669
  "color-syntax-comment": "#626772",
1670
+ "color-syntax-function": "#715b42",
1671
+ "color-syntax-type": "#86532e",
1672
+ "color-syntax-variable": "#101315",
1673
+ "color-syntax-operator": "#50575e",
1674
+ "color-syntax-punctuation": "#50575e",
1675
+ "color-syntax-tag": "#715b42",
1676
+ "color-syntax-attribute": "#86532e",
1572
1677
  "text-xs": "0.75rem",
1573
1678
  "text-sm": "0.8125rem",
1574
1679
  "text-md": "0.875rem",
@@ -1676,6 +1781,13 @@ export const tokens = {
1676
1781
  "color-syntax-string": "#a8bd9c",
1677
1782
  "color-syntax-number": "#d5b98c",
1678
1783
  "color-syntax-comment": "#a0a6b1",
1784
+ "color-syntax-function": "#d8c2a5",
1785
+ "color-syntax-type": "#d5b98c",
1786
+ "color-syntax-variable": "#e6e9eb",
1787
+ "color-syntax-operator": "#9aa3ab",
1788
+ "color-syntax-punctuation": "#9aa3ab",
1789
+ "color-syntax-tag": "#d8c2a5",
1790
+ "color-syntax-attribute": "#d5b98c",
1679
1791
  "text-xs": "0.75rem",
1680
1792
  "text-sm": "0.8125rem",
1681
1793
  "text-md": "0.875rem",
package/dist/tokens.json CHANGED
@@ -56,6 +56,13 @@
56
56
  "color-syntax-string": "#346347",
57
57
  "color-syntax-number": "#86532e",
58
58
  "color-syntax-comment": "#626772",
59
+ "color-syntax-function": "#715b42",
60
+ "color-syntax-type": "#86532e",
61
+ "color-syntax-variable": "#101315",
62
+ "color-syntax-operator": "#50575e",
63
+ "color-syntax-punctuation": "#50575e",
64
+ "color-syntax-tag": "#715b42",
65
+ "color-syntax-attribute": "#86532e",
59
66
  "text-xs": "0.75rem",
60
67
  "text-sm": "0.8125rem",
61
68
  "text-md": "0.875rem",
@@ -163,6 +170,13 @@
163
170
  "color-syntax-string": "#a8bd9c",
164
171
  "color-syntax-number": "#d5b98c",
165
172
  "color-syntax-comment": "#a0a6b1",
173
+ "color-syntax-function": "#d8c2a5",
174
+ "color-syntax-type": "#d5b98c",
175
+ "color-syntax-variable": "#e6e9eb",
176
+ "color-syntax-operator": "#9aa3ab",
177
+ "color-syntax-punctuation": "#9aa3ab",
178
+ "color-syntax-tag": "#d8c2a5",
179
+ "color-syntax-attribute": "#d5b98c",
166
180
  "text-xs": "0.75rem",
167
181
  "text-sm": "0.8125rem",
168
182
  "text-md": "0.875rem",
@@ -272,6 +286,13 @@
272
286
  "color-syntax-string": "#346347",
273
287
  "color-syntax-number": "#86532e",
274
288
  "color-syntax-comment": "#626772",
289
+ "color-syntax-function": "#715b42",
290
+ "color-syntax-type": "#86532e",
291
+ "color-syntax-variable": "#4c4f69",
292
+ "color-syntax-operator": "#5c5f77",
293
+ "color-syntax-punctuation": "#5c5f77",
294
+ "color-syntax-tag": "#715b42",
295
+ "color-syntax-attribute": "#86532e",
275
296
  "text-xs": "0.75rem",
276
297
  "text-sm": "0.8125rem",
277
298
  "text-md": "0.875rem",
@@ -379,6 +400,13 @@
379
400
  "color-syntax-string": "#a8bd9c",
380
401
  "color-syntax-number": "#d5b98c",
381
402
  "color-syntax-comment": "#a0a6b1",
403
+ "color-syntax-function": "#d8c2a5",
404
+ "color-syntax-type": "#d5b98c",
405
+ "color-syntax-variable": "#cdd6f4",
406
+ "color-syntax-operator": "#a6adc8",
407
+ "color-syntax-punctuation": "#a6adc8",
408
+ "color-syntax-tag": "#d8c2a5",
409
+ "color-syntax-attribute": "#d5b98c",
382
410
  "text-xs": "0.75rem",
383
411
  "text-sm": "0.8125rem",
384
412
  "text-md": "0.875rem",
@@ -488,6 +516,13 @@
488
516
  "color-syntax-string": "#346347",
489
517
  "color-syntax-number": "#86532e",
490
518
  "color-syntax-comment": "#626772",
519
+ "color-syntax-function": "#715b42",
520
+ "color-syntax-type": "#86532e",
521
+ "color-syntax-variable": "#101315",
522
+ "color-syntax-operator": "#50575e",
523
+ "color-syntax-punctuation": "#50575e",
524
+ "color-syntax-tag": "#715b42",
525
+ "color-syntax-attribute": "#86532e",
491
526
  "text-xs": "0.75rem",
492
527
  "text-sm": "0.8125rem",
493
528
  "text-md": "0.875rem",
@@ -595,6 +630,13 @@
595
630
  "color-syntax-string": "#a8bd9c",
596
631
  "color-syntax-number": "#d5b98c",
597
632
  "color-syntax-comment": "#a0a6b1",
633
+ "color-syntax-function": "#d8c2a5",
634
+ "color-syntax-type": "#d5b98c",
635
+ "color-syntax-variable": "#e6e9eb",
636
+ "color-syntax-operator": "#9aa3ab",
637
+ "color-syntax-punctuation": "#9aa3ab",
638
+ "color-syntax-tag": "#d8c2a5",
639
+ "color-syntax-attribute": "#d5b98c",
598
640
  "text-xs": "0.75rem",
599
641
  "text-sm": "0.8125rem",
600
642
  "text-md": "0.875rem",
@@ -704,6 +746,13 @@
704
746
  "color-syntax-string": "#346347",
705
747
  "color-syntax-number": "#86532e",
706
748
  "color-syntax-comment": "#626772",
749
+ "color-syntax-function": "#715b42",
750
+ "color-syntax-type": "#86532e",
751
+ "color-syntax-variable": "#101315",
752
+ "color-syntax-operator": "#50575e",
753
+ "color-syntax-punctuation": "#50575e",
754
+ "color-syntax-tag": "#715b42",
755
+ "color-syntax-attribute": "#86532e",
707
756
  "text-xs": "0.75rem",
708
757
  "text-sm": "0.8125rem",
709
758
  "text-md": "0.875rem",
@@ -811,6 +860,13 @@
811
860
  "color-syntax-string": "#a8bd9c",
812
861
  "color-syntax-number": "#d5b98c",
813
862
  "color-syntax-comment": "#a0a6b1",
863
+ "color-syntax-function": "#d8c2a5",
864
+ "color-syntax-type": "#d5b98c",
865
+ "color-syntax-variable": "#e6e9eb",
866
+ "color-syntax-operator": "#9aa3ab",
867
+ "color-syntax-punctuation": "#9aa3ab",
868
+ "color-syntax-tag": "#d8c2a5",
869
+ "color-syntax-attribute": "#d5b98c",
814
870
  "text-xs": "0.75rem",
815
871
  "text-sm": "0.8125rem",
816
872
  "text-md": "0.875rem",
@@ -920,6 +976,13 @@
920
976
  "color-syntax-string": "#346347",
921
977
  "color-syntax-number": "#86532e",
922
978
  "color-syntax-comment": "#626772",
979
+ "color-syntax-function": "#715b42",
980
+ "color-syntax-type": "#86532e",
981
+ "color-syntax-variable": "#1f2328",
982
+ "color-syntax-operator": "#59636e",
983
+ "color-syntax-punctuation": "#59636e",
984
+ "color-syntax-tag": "#715b42",
985
+ "color-syntax-attribute": "#86532e",
923
986
  "text-xs": "0.75rem",
924
987
  "text-sm": "0.8125rem",
925
988
  "text-md": "0.875rem",
@@ -1027,6 +1090,13 @@
1027
1090
  "color-syntax-string": "#a8bd9c",
1028
1091
  "color-syntax-number": "#d5b98c",
1029
1092
  "color-syntax-comment": "#a0a6b1",
1093
+ "color-syntax-function": "#d8c2a5",
1094
+ "color-syntax-type": "#d5b98c",
1095
+ "color-syntax-variable": "#f0f6fc",
1096
+ "color-syntax-operator": "#9198a1",
1097
+ "color-syntax-punctuation": "#9198a1",
1098
+ "color-syntax-tag": "#d8c2a5",
1099
+ "color-syntax-attribute": "#d5b98c",
1030
1100
  "text-xs": "0.75rem",
1031
1101
  "text-sm": "0.8125rem",
1032
1102
  "text-md": "0.875rem",
@@ -1136,6 +1206,13 @@
1136
1206
  "color-syntax-string": "#346347",
1137
1207
  "color-syntax-number": "#86532e",
1138
1208
  "color-syntax-comment": "#626772",
1209
+ "color-syntax-function": "#715b42",
1210
+ "color-syntax-type": "#86532e",
1211
+ "color-syntax-variable": "#101315",
1212
+ "color-syntax-operator": "#50575e",
1213
+ "color-syntax-punctuation": "#50575e",
1214
+ "color-syntax-tag": "#715b42",
1215
+ "color-syntax-attribute": "#86532e",
1139
1216
  "text-xs": "0.75rem",
1140
1217
  "text-sm": "0.8125rem",
1141
1218
  "text-md": "0.875rem",
@@ -1243,6 +1320,13 @@
1243
1320
  "color-syntax-string": "#a8bd9c",
1244
1321
  "color-syntax-number": "#d5b98c",
1245
1322
  "color-syntax-comment": "#a0a6b1",
1323
+ "color-syntax-function": "#d8c2a5",
1324
+ "color-syntax-type": "#d5b98c",
1325
+ "color-syntax-variable": "#e6e9eb",
1326
+ "color-syntax-operator": "#9aa3ab",
1327
+ "color-syntax-punctuation": "#9aa3ab",
1328
+ "color-syntax-tag": "#d8c2a5",
1329
+ "color-syntax-attribute": "#d5b98c",
1246
1330
  "text-xs": "0.75rem",
1247
1331
  "text-sm": "0.8125rem",
1248
1332
  "text-md": "0.875rem",
@@ -1352,6 +1436,13 @@
1352
1436
  "color-syntax-string": "#346347",
1353
1437
  "color-syntax-number": "#86532e",
1354
1438
  "color-syntax-comment": "#626772",
1439
+ "color-syntax-function": "#715b42",
1440
+ "color-syntax-type": "#86532e",
1441
+ "color-syntax-variable": "#101315",
1442
+ "color-syntax-operator": "#50575e",
1443
+ "color-syntax-punctuation": "#50575e",
1444
+ "color-syntax-tag": "#715b42",
1445
+ "color-syntax-attribute": "#86532e",
1355
1446
  "text-xs": "0.75rem",
1356
1447
  "text-sm": "0.8125rem",
1357
1448
  "text-md": "0.875rem",
@@ -1459,6 +1550,13 @@
1459
1550
  "color-syntax-string": "#a8bd9c",
1460
1551
  "color-syntax-number": "#d5b98c",
1461
1552
  "color-syntax-comment": "#a0a6b1",
1553
+ "color-syntax-function": "#d8c2a5",
1554
+ "color-syntax-type": "#d5b98c",
1555
+ "color-syntax-variable": "#e6e9eb",
1556
+ "color-syntax-operator": "#9aa3ab",
1557
+ "color-syntax-punctuation": "#9aa3ab",
1558
+ "color-syntax-tag": "#d8c2a5",
1559
+ "color-syntax-attribute": "#d5b98c",
1462
1560
  "text-xs": "0.75rem",
1463
1561
  "text-sm": "0.8125rem",
1464
1562
  "text-md": "0.875rem",
@@ -1568,6 +1666,13 @@
1568
1666
  "color-syntax-string": "#346347",
1569
1667
  "color-syntax-number": "#86532e",
1570
1668
  "color-syntax-comment": "#626772",
1669
+ "color-syntax-function": "#715b42",
1670
+ "color-syntax-type": "#86532e",
1671
+ "color-syntax-variable": "#101315",
1672
+ "color-syntax-operator": "#50575e",
1673
+ "color-syntax-punctuation": "#50575e",
1674
+ "color-syntax-tag": "#715b42",
1675
+ "color-syntax-attribute": "#86532e",
1571
1676
  "text-xs": "0.75rem",
1572
1677
  "text-sm": "0.8125rem",
1573
1678
  "text-md": "0.875rem",
@@ -1675,6 +1780,13 @@
1675
1780
  "color-syntax-string": "#a8bd9c",
1676
1781
  "color-syntax-number": "#d5b98c",
1677
1782
  "color-syntax-comment": "#a0a6b1",
1783
+ "color-syntax-function": "#d8c2a5",
1784
+ "color-syntax-type": "#d5b98c",
1785
+ "color-syntax-variable": "#e6e9eb",
1786
+ "color-syntax-operator": "#9aa3ab",
1787
+ "color-syntax-punctuation": "#9aa3ab",
1788
+ "color-syntax-tag": "#d8c2a5",
1789
+ "color-syntax-attribute": "#d5b98c",
1678
1790
  "text-xs": "0.75rem",
1679
1791
  "text-sm": "0.8125rem",
1680
1792
  "text-md": "0.875rem",
@@ -498,6 +498,7 @@
498
498
  .code .line > span { white-space: pre; }
499
499
  .code .ln { min-width: 2.5em; padding-right: 1em; flex: none; text-align: right; color: var(--color-muted); user-select: none; }
500
500
  .code .k { color: var(--color-syntax-keyword); } .code .s { color: var(--color-syntax-string); } .code .n { color: var(--color-syntax-number); } .code .c { color: var(--color-syntax-comment); }
501
+ .code .f { color: var(--color-syntax-function); } .code .t { color: var(--color-syntax-type); } .code .v { color: var(--color-syntax-variable); } .code .o { color: var(--color-syntax-operator); } .code .p { color: var(--color-syntax-punctuation); } .code .g { color: var(--color-syntax-tag); } .code .a { color: var(--color-syntax-attribute); }
501
502
  /* The panel fills the row beside Copy, so it sits --space-1 from the frame and from Copy on every side, and centres its line. */
502
503
  .code.compact { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-1); }
503
504
  .code.compact pre { align-content: center; padding: var(--space-2) var(--space-3); }
@@ -1417,11 +1418,11 @@
1417
1418
  <p class="purpose">Source code with an optional header and Copy, and a live example above it.</p>
1418
1419
  <dl class="guidance"><dt>Do</dt><dd>Use a code block for source with no live result. When the reader should see the result too, use the variant with a live example.</dd><dt>Don’t</dt><dd>The same language label on every block of a page. Put useful setup context above the block instead.</dd></dl>
1419
1420
  <div class="row"><h4>Source well</h4><div class="states">
1420
- <div class="state wide"><div class="code"><div class="code-head"><b>monitor.ts</b><span class="lang">TypeScript</span><button class="quiet-action copy" type="button" data-copy="code-src"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg>Copy</button></div><pre tabindex="0" role="region" aria-label="monitor.ts"><code id="code-src"><span class="line"><span class="ln">1</span><span><span class="k">const</span> threshold = <span class="n">300</span> <span class="c">// ms at p95</span></span></span><span class="line"><span class="ln">2</span><span><span class="k">export const</span> name = <span class="s">'API p95 latency'</span></span></span></code></pre></div><span class="caption">Header, line numbers, and Copy, live</span></div>
1421
+ <div class="state wide"><div class="code"><div class="code-head"><b>monitor.ts</b><span class="lang">TypeScript</span><button class="quiet-action copy" type="button" data-copy="code-src"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg>Copy</button></div><pre tabindex="0" role="region" aria-label="monitor.ts"><code id="code-src"><span class="line"><span class="ln">1</span><span><span class="k">const</span> <span class="v">threshold</span> <span class="o">=</span> <span class="n">300</span> <span class="c">// ms at p95</span></span></span><span class="line"><span class="ln">2</span><span><span class="k">export const</span> <span class="v">name</span> <span class="o">=</span> <span class="s">'API p95 latency'</span></span></span><span class="line"><span class="ln">3</span><span><span class="k">export function</span> <span class="f">breached</span><span class="p">(</span><span class="v">p95</span><span class="p">:</span> <span class="t">number</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="v">p95</span> <span class="o">&gt;</span> <span class="v">threshold</span> <span class="p">}</span></span></span></code></pre></div><span class="caption">Header, line numbers, and Copy, live</span></div>
1421
1422
  <div class="state wide" inert><div class="code compact"><pre><code><span class="line"><span>import { threshold } from './monitor'</span></span></code></pre><button class="quiet-action copy is-focus" type="button" aria-label="Copy import"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg></button></div><span class="caption">Compact, with focus visible on Copy</span></div>
1422
1423
  </div></div>
1423
1424
  <div class="row"><h4>With a live example</h4><div class="states">
1424
- <div class="state wide"><figure class="example"><div class="example-stage"><div style="display:flex;gap:var(--space-2);flex-wrap:wrap"><button class="btn secondary" type="button">Cancel</button><button class="btn" type="button">Save monitor</button></div></div><div class="code"><button class="quiet-action copy" type="button" data-copy="example-src" aria-label="Copy code" title="Copy code"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg></button><pre tabindex="0" role="region" aria-label="Example source"><code id="example-src"><span class="line"><span>&lt;<span class="k">button</span> class=<span class="s">"btn secondary"</span> type=<span class="s">"button"</span>&gt;Cancel&lt;/<span class="k">button</span>&gt;</span></span><span class="line"><span>&lt;<span class="k">button</span> class=<span class="s">"btn"</span> type=<span class="s">"button"</span>&gt;Save monitor&lt;/<span class="k">button</span>&gt;</span></span></code></pre></div></figure><span class="caption">Live: the stage on the page background, the source below one hairline, and Copy in its corner</span></div>
1425
+ <div class="state wide"><figure class="example"><div class="example-stage"><div style="display:flex;gap:var(--space-2);flex-wrap:wrap"><button class="btn secondary" type="button">Cancel</button><button class="btn" type="button">Save monitor</button></div></div><div class="code"><button class="quiet-action copy" type="button" data-copy="example-src" aria-label="Copy code" title="Copy code"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg></button><pre tabindex="0" role="region" aria-label="Example source"><code id="example-src"><span class="line"><span>&lt;<span class="g">button</span> <span class="a">class</span>=<span class="s">"btn secondary"</span> <span class="a">type</span>=<span class="s">"button"</span>&gt;Cancel&lt;/<span class="g">button</span>&gt;</span></span><span class="line"><span>&lt;<span class="g">button</span> <span class="a">class</span>=<span class="s">"btn"</span> <span class="a">type</span>=<span class="s">"button"</span>&gt;Save monitor&lt;/<span class="g">button</span>&gt;</span></span></code></pre></div></figure><span class="caption">Live: the stage on the page background, the source below one hairline, and Copy in its corner</span></div>
1425
1426
  </div></div>
1426
1427
  <p class="sr-only" role="status" id="copy-status"></p>
1427
1428
  </section>
@@ -22,7 +22,7 @@ Each entry records a choice this language made, the options it rejected, and why
22
22
  | Segmented label | Core | The selected label reads at 4.5:1 on its thumb, and an icon at 3:1 (`--color-segmented-current-text`): `--color-accent`, or the first of `--color-text`, black, and white that reads. | Accent at 3:1 for labels too, which let some hues' text fall below 4.5:1. | label contrast: `tests/catalogue/catalogue.spec.ts` "contrast: every selected segmented label on its thumb reaches 4.5:1"; icon at 3:1: no test yet |
23
23
  | Phone drawer trigger | Core | A page-level contents drawer opens from a soft secondary button with a three-line menu glyph and a label. The no-JavaScript fallback keeps a chevron, because it opens in place. The site shell uses the same trigger below its header (see Phone header). | A down chevron promised a dropdown, but the trigger opens a side drawer. | No test yet |
24
24
  | Shape follows role | Core | A pill acts, or sets a value in place with every option shown, on one line (`--radius-control`); a select, which opens a list, is a one-line non-action control. Small state marks are pills (`--radius-pill`). Places and picked rows are 6px (`--radius-inline`). Typed fields, controls whose label wraps, and one-line controls that are not actions are 10px (`--radius-field`). Containers are 16px (`--radius-panel`). A pill never holds text that can wrap, and nested rectangles are concentric. The token names predate the rule: they say inline, control, and field, where the uses are rows, pills, and typed fields. The names stay, because a rename breaks every page that uses them. | One shape for every control. All pills put wrapping labels in pills, which the toggle card, fields, and the raised pill row already rejected; all rectangles lose the shape that marks an action. A list of components for each token with no reason: a new component had no rule to pick from, and a reader took a 6px row beside a pill for an error. | rendered corners by role: `tests/catalogue/catalogue.spec.ts` "each component renders the corner radius of its role, and no other part has one", "the DESIGN.md shape table names each role token with its value"; slider track and thumb, and select picker: `tests/design-foundations.test.mjs` "the slider track, slider thumb, and select picker take their role’s corners"; no literal radius: `tests/design-foundations.test.mjs` "no page or the report stylesheet writes a literal corner radius" |
25
- | Themes | Core | A theme sets only its inputs: a hue for light and for dark, and optionally its two fonts and its neutrals (page, surfaces, hover, edges, and text, as a whole set for both modes). Shape, spacing, states, and status colours stay core, so actions are pills in every theme. Neutrals are an input so an open palette keeps its own surfaces: Catppuccin and GitHub's Primer ship as themes, each mapped by its palette's own roles and unaltered. Where a hue cannot carry the text on a selected fill at 4.5:1, the build takes the first of the theme's text colour, black, and white that can, as the token roles say. Every theme passes the contrast guards in both modes. Theme files use the W3C Design Tokens format (2025.10) and ship beside the CSS, so design-token tools can read and write them: one file per theme, with a `light` and a `dark` group of sRGB colour tokens. Tools read the two groups as separate tokens (`light.color-bg`, `dark.color-bg`), not as one token with two modes; the Design Tokens Resolver module expresses modes, and it can replace the groups once tools support it. Graphite Indigo is the default. The family sites' own hues ship as themes named for their colour, so a site can load its theme file in place of an inline hue pair: Lagoon (annoterm), Copper (devps), Iris (filip-stack), Lapis (Workbench), and Fern (wtree). Each theme's note names its site. Where a site's light hue falls just short of 4.5:1 as selected-row text, its theme takes the smallest OKLCH lightness step that passes and keeps the hue and chroma, so the selection keeps the hue; the site can adopt the theme's value. A third-party palette is never altered. The theme mapper (`./theme-mapper`, experimental) turns a VS Code colour theme into these inputs for its one mode by selection: each input takes the first of its keys whose colour passes that input's contrast gate, and no colour is changed. What still fails is reported, as a `theme` problem in the theme's colours or a `core` problem in a core link, status, syntax, or command-plate colour on its fills. The checks are data: every ink on every fill the catalogue draws, hover and pressed states included, so a state axe never renders is still measured. Syntax colours stay core: comment colours in 6 of 8 popular dark themes measure 2.3–4.0:1 on their own editor background, so syntax as an input would flag nearly every import. The build and the mapper share one engine for applying a theme, resolving it, and checking it. | The action shape as a theme input (a pill, the 10px field corner, or the 6px row corner): each rounded choice gives actions another role's shape, a select's at 10px and a tab's or row's at 6px, so shape stops telling an action from a field. Radix Themes and shadcn scale every corner together, and Primer, Carbon, Polaris, and Spectrum keep shape core; revisit it as a whole radius scale when a theme needs one. Linear and OpenAI themes: neither publishes an open palette, and their colours are brand identity. Pine and Mauve, the earlier invented themes: no product used them, and they read as unrelated to the family's sites. A grey-blue quiet theme (Slate): it sat beside the muted text and the info blue, so its selection read as metadata and its primary button looked disabled. Adjusting an imported colour until it passes: the result is no longer the theme, and nothing tells the reader it changed. Syntax colours as a theme input: most imports would fail on their comment colours alone. | Per-theme contrast guards (`tests/design-foundations.test.mjs`), the catalogue's rendered recipes in every theme, the Themes page tests, and the theme mapper's tests (`tests/theme-mapper.test.mjs`, the React smoke test with the mode locked opposite the system's, and the catalogue test that every axe contrast failure is a reported problem) |
25
+ | Themes | Core | A theme sets only its inputs: a hue for light and for dark, and optionally its two fonts, its neutrals (page, surfaces, hover, edges, and text, as a whole set for both modes), and, for a theme imported at runtime through the mapper, any of its 11 syntax colours (`--color-syntax-*`); theme files do not take syntax colours. Shape, spacing, states, and status colours stay core, so actions are pills in every theme. Neutrals are an input so an open palette keeps its own surfaces: Catppuccin and GitHub's Primer ship as themes, each mapped by its palette's own roles and unaltered. Where a hue cannot carry the text on a selected fill at 4.5:1, the build takes the first of the theme's text colour, black, and white that can, as the token roles say. Every theme passes the contrast guards in both modes. Theme files use the W3C Design Tokens format (2025.10) and ship beside the CSS, so design-token tools can read and write them: one file per theme, with a `light` and a `dark` group of sRGB colour tokens. Tools read the two groups as separate tokens (`light.color-bg`, `dark.color-bg`), not as one token with two modes; the Design Tokens Resolver module expresses modes, and it can replace the groups once tools support it. Graphite Indigo is the default. The family sites' own hues ship as themes named for their colour, so a site can load its theme file in place of an inline hue pair: Lagoon (annoterm), Copper (devps), Iris (filip-stack), Lapis (Workbench), and Fern (wtree). Each theme's note names its site. Where a site's light hue falls just short of 4.5:1 as selected-row text, its theme takes the smallest OKLCH lightness step that passes and keeps the hue and chroma, so the selection keeps the hue; the site can adopt the theme's value. A third-party palette is never altered. The theme mapper (`./theme-mapper`, experimental) turns a VS Code colour theme into these inputs for its one mode by selection: each input takes the first of its keys whose colour passes that input's contrast gate, and no colour is changed. What still fails is reported, as a `theme` problem in the theme's colours or a `core` problem in a core link, status, syntax, or command-plate colour on its fills. The checks are data: every ink on every fill the catalogue draws, hover and pressed states included, so a state axe never renders is still measured. The mapper keeps an imported theme's syntax colours too, from its `tokenColors`: each role takes the rule nearest its scope family. A role the theme leaves out takes its core colour; keyword, string, number, and comment have core colours, and the other 7 follow one of them or the code text. The owner chose this on 2026-11-14 to support open themes as their authors made them: the person who installs a theme owns its contrast, so a failing syntax colour is reported as a `theme` problem, never blocked or replaced. Most imports report one: comments in 5 of 8 popular themes measure 2.4–3.7:1 on their own background. The checks stay at 4.5:1, the WCAG AA minimum for text of this size; 3:1 would clear only 2 of those 5. The build and the mapper share one engine for applying a theme, resolving it, and checking it. | The action shape as a theme input (a pill, the 10px field corner, or the 6px row corner): each rounded choice gives actions another role's shape, a select's at 10px and a tab's or row's at 6px, so shape stops telling an action from a field. Radix Themes and shadcn scale every corner together, and Primer, Carbon, Polaris, and Spectrum keep shape core; revisit it as a whole radius scale when a theme needs one. Linear and OpenAI themes: neither publishes an open palette, and their colours are brand identity. Pine and Mauve, the earlier invented themes: no product used them, and they read as unrelated to the family's sites. A grey-blue quiet theme (Slate): it sat beside the muted text and the info blue, so its selection read as metadata and its primary button looked disabled. Adjusting an imported colour until it passes: the result is no longer the theme, and nothing tells the reader it changed. Syntax colours kept core for imports: an import lost its author's code colours to stay clear of reports. A looser bar for syntax, such as 3:1: it is below AA for code text, and it clears few imports. | Per-theme contrast guards (`tests/design-foundations.test.mjs`), the catalogue's rendered recipes in every theme, the Themes page tests, and the theme mapper's tests (`tests/theme-mapper.test.mjs`, the React smoke test with the mode locked opposite the system's, and the catalogue test that every axe contrast failure is a reported problem) |
26
26
  | Navigation row corners | Core | Navigation rows, header and strip rows, list-selection rows, collapsible group labels, and tabs take 6px corners (`--radius-inline`), except rows inside a floating menu (see Floating-menu rows). The owner chose the more rectangular rows from the Gate M mockup (2026-11-09). | 10px (`--radius-field`), the previous corners, shared with fields. | 6px corners: `tests/catalogue/catalogue.spec.ts` "each component renders the corner radius of its role, and no other part has one"; Foundations swatch: `tests/design-foundations.test.mjs` "the Foundations current-row swatch and radius list follow the navigation row radius" |
27
27
  | Floating-menu rows | Core | Rows inside a floating menu, such as the project menu, are concentric with the 16px menu: `calc(var(--radius-panel) - var(--space-1))`, 12px, as select picker rows are. The owner approved it from the DS-3b comparison. | 6px like rail rows: a 6px row inside a 16px panel looks pinched. | 12px corners: `tests/catalogue/catalogue.spec.ts` "each component renders the corner radius of its role, and no other part has one" |
28
28
  | One-line non-action controls | Core | A one-line control that is not an action takes the 10px field corner (`--radius-field`), as a select does: the select, the project-menu trigger, the labelled contents trigger and its no-JavaScript summary ("On this page"), and the skip link. The project trigger keeps the quiet-action tint. The owner chose it on 2026-11-10. | The pill (`--radius-control`): a pill means an action, and these controls open a menu or list, pick a value, or move focus. 16px (`--radius-panel`), like the menu and other floating layers: on a one-line control 40 to 44px tall it reads almost as a pill. | 10px corners: `tests/catalogue/catalogue.spec.ts` "each component renders the corner radius of its role, and no other part has one" |
@@ -138,4 +138,5 @@ Prose patterns moved with the names: `--*-soft` is now `--color-*-surface`, and
138
138
  ## Known gaps
139
139
 
140
140
  - Field focus is a 1px `--color-accent` edge with a faint 2px inset line. The edge reaches 3:1 for a focus indicator (WCAG 1.4.11): 6.61:1 against the light field fill and 6.26:1 against `--color-bg`, and 8.43:1 and 8.31:1 in dark. It is thinner than the 2px perimeter that the WCAG 2.2 AAA focus appearance criterion (2.4.13) asks for; the inset line, at 18% of the accent, does not reach 3:1 on its own.
141
+ - The off track of a switch or toggle (`color-mix(in srgb, var(--color-border) 90%, var(--color-well))`) has no contrast check. It falls below the 3:1 that WCAG 1.4.11 asks of a component's visible boundary in two shipped themes: Catppuccin light, 2.86:1 on `--color-surface`, and GitHub, 2.84:1 on `--color-surface` in light and on `--color-surface` and `--color-surface-raised` in dark. Both palettes are open and never altered, so a check would fail them. The knob's position still shows the state. A checkable off track needs a new recipe, such as unmixed `--color-border`, which the `edge` check already guards; that darkens the off track in every theme.
141
142
  - In forced colors (high contrast), an invalid field shows the system edge, not the `--color-error` edge, focused or not; the error text carries the state. A visible high-contrast invalid edge needs an error colour validated against high-contrast fills.
@@ -644,6 +644,13 @@
644
644
  <li class="swatch" data-token="--color-syntax-string" data-on="--color-code" data-min="4.5"><i class="chip" aria-hidden="true"></i><code>--color-syntax-string</code><span class="value"></span><span class="ratio"></span></li>
645
645
  <li class="swatch" data-token="--color-syntax-number" data-on="--color-code" data-min="4.5"><i class="chip" aria-hidden="true"></i><code>--color-syntax-number</code><span class="value"></span><span class="ratio"></span></li>
646
646
  <li class="swatch" data-token="--color-syntax-comment" data-on="--color-code" data-min="4.5"><i class="chip" aria-hidden="true"></i><code>--color-syntax-comment</code><span class="value"></span><span class="ratio"></span></li>
647
+ <li class="swatch" data-token="--color-syntax-function" data-on="--color-code" data-min="4.5"><i class="chip" aria-hidden="true"></i><code>--color-syntax-function</code><span class="value"></span><span class="ratio"></span></li>
648
+ <li class="swatch" data-token="--color-syntax-type" data-on="--color-code" data-min="4.5"><i class="chip" aria-hidden="true"></i><code>--color-syntax-type</code><span class="value"></span><span class="ratio"></span></li>
649
+ <li class="swatch" data-token="--color-syntax-variable" data-on="--color-code" data-min="4.5"><i class="chip" aria-hidden="true"></i><code>--color-syntax-variable</code><span class="value"></span><span class="ratio"></span></li>
650
+ <li class="swatch" data-token="--color-syntax-operator" data-on="--color-code" data-min="4.5"><i class="chip" aria-hidden="true"></i><code>--color-syntax-operator</code><span class="value"></span><span class="ratio"></span></li>
651
+ <li class="swatch" data-token="--color-syntax-punctuation" data-on="--color-code" data-min="4.5"><i class="chip" aria-hidden="true"></i><code>--color-syntax-punctuation</code><span class="value"></span><span class="ratio"></span></li>
652
+ <li class="swatch" data-token="--color-syntax-tag" data-on="--color-code" data-min="4.5"><i class="chip" aria-hidden="true"></i><code>--color-syntax-tag</code><span class="value"></span><span class="ratio"></span></li>
653
+ <li class="swatch" data-token="--color-syntax-attribute" data-on="--color-code" data-min="4.5"><i class="chip" aria-hidden="true"></i><code>--color-syntax-attribute</code><span class="value"></span><span class="ratio"></span></li>
647
654
  <li class="swatch" data-token="--color-command-bg"><i class="chip" aria-hidden="true"></i><code>--color-command-bg</code><span class="value"></span><span class="use">Command plate, tinted with the hue, in both themes</span></li>
648
655
  <li class="swatch" data-token="--color-command-border"><i class="chip" aria-hidden="true"></i><code>--color-command-border</code><span class="value"></span><span class="use">Command plate edge; transparent in light</span></li>
649
656
  <li class="swatch" data-token="--color-terminal-text" data-fg="var(--color-terminal-text)" data-on="--color-command-bg" data-min="4.5"><i class="chip" aria-hidden="true"></i><code>--color-terminal-text</code><span class="value"></span><span class="ratio"></span><span class="use">Command text</span></li>
@@ -104,6 +104,13 @@
104
104
  --color-syntax-string: #346347;
105
105
  --color-syntax-number: #86532e;
106
106
  --color-syntax-comment: #626772;
107
+ --color-syntax-function: var(--color-syntax-keyword);
108
+ --color-syntax-type: var(--color-syntax-number);
109
+ --color-syntax-variable: var(--color-code-text);
110
+ --color-syntax-operator: var(--color-muted);
111
+ --color-syntax-punctuation: var(--color-muted);
112
+ --color-syntax-tag: var(--color-syntax-keyword);
113
+ --color-syntax-attribute: var(--color-syntax-number);
107
114
 
108
115
  /* Type scale. The identity block names the families. */
109
116
  --text-xs: 0.75rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filipgutica/design-system",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "Filip's design language, tokens, and component catalogue for any framework",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -171,7 +171,14 @@ export const core = {
171
171
  "color-syntax-comment": [
172
172
  "#626772",
173
173
  "#a0a6b1"
174
- ]
174
+ ],
175
+ "color-syntax-function": "{color-syntax-keyword}",
176
+ "color-syntax-type": "{color-syntax-number}",
177
+ "color-syntax-variable": "{color-code-text}",
178
+ "color-syntax-operator": "{color-muted}",
179
+ "color-syntax-punctuation": "{color-muted}",
180
+ "color-syntax-tag": "{color-syntax-keyword}",
181
+ "color-syntax-attribute": "{color-syntax-number}"
175
182
  }
176
183
  },
177
184
  {
@@ -13,6 +13,8 @@
13
13
  * @property {ModePair} hue The hue, `--color-project` in light and `--color-project-dark`.
14
14
  * @property {{ ui?: string, mono?: string }} [fonts] The two font stacks.
15
15
  * @property {{ light: Record<string, string>, dark: Record<string, string> }} [neutrals] Every NEUTRALS token, per mode.
16
+ * @property {{ light?: Record<string, string>, dark?: Record<string, string> }} [syntax] Syntax colours by SYNTAX_ROLES
17
+ * role, per mode. A role a theme leaves out stays core.
16
18
  */
17
19
  /**
18
20
  * Every token's resolved value in light and in dark, as getComputedStyle reports it.
@@ -37,6 +39,11 @@ export function flatTokens(data: TokenSource): {
37
39
  };
38
40
  export function valueFor(tokens: Record<string, TokenValue>, name: string, mode: number): string;
39
41
  export function resolveData(data: TokenSource): ResolvedValues;
42
+ /**
43
+ * The syntax roles, `--color-syntax-<role>`. Keyword, string, number, and comment have core colours; the others
44
+ * follow one of those or the code text, muted or not, unless a theme sets them.
45
+ */
46
+ export const SYNTAX_ROLES: string[];
40
47
  /** The surfaces text and edges sit on: the page, a surface, and a raised surface. */
41
48
  export const SURFACES: string[];
42
49
  /** The selected-fill text tokens, which take their readable value from the theme. */
@@ -89,6 +96,14 @@ export type ThemeInputs = {
89
96
  light: Record<string, string>;
90
97
  dark: Record<string, string>;
91
98
  } | undefined;
99
+ /**
100
+ * Syntax colours by SYNTAX_ROLES
101
+ * role, per mode. A role a theme leaves out stays core.
102
+ */
103
+ syntax?: {
104
+ light?: Record<string, string>;
105
+ dark?: Record<string, string>;
106
+ } | undefined;
92
107
  };
93
108
  /**
94
109
  * Every token's resolved value in light and in dark, as getComputedStyle reports it.
@@ -17,6 +17,8 @@
17
17
  * @property {ModePair} hue The hue, `--color-project` in light and `--color-project-dark`.
18
18
  * @property {{ ui?: string, mono?: string }} [fonts] The two font stacks.
19
19
  * @property {{ light: Record<string, string>, dark: Record<string, string> }} [neutrals] Every NEUTRALS token, per mode.
20
+ * @property {{ light?: Record<string, string>, dark?: Record<string, string> }} [syntax] Syntax colours by SYNTAX_ROLES
21
+ * role, per mode. A role a theme leaves out stays core.
20
22
  */
21
23
  /**
22
24
  * Every token's resolved value in light and in dark, as getComputedStyle reports it.
@@ -140,6 +142,12 @@ export const resolveData = (data) => {
140
142
  return { light: values(LIGHT), dark: values(DARK) }
141
143
  }
142
144
 
145
+ /**
146
+ * The syntax roles, `--color-syntax-<role>`. Keyword, string, number, and comment have core colours; the others
147
+ * follow one of those or the code text, muted or not, unless a theme sets them.
148
+ */
149
+ export const SYNTAX_ROLES = ['keyword', 'string', 'number', 'comment', 'function', 'type', 'variable', 'operator', 'punctuation', 'tag', 'attribute']
150
+
143
151
  /** The surfaces text and edges sit on: the page, a surface, and a raised surface. */
144
152
  export const SURFACES = ['color-bg', 'color-surface', 'color-surface-raised']
145
153
 
@@ -199,6 +207,13 @@ export const applyTheme = (core, theme) => {
199
207
  if (theme.fonts?.mono) identity['font-mono'] = theme.fonts.mono
200
208
  const { neutrals } = theme
201
209
  if (neutrals) for (const name of NEUTRALS) groupOf(data, name).tokens[name] = [neutrals.light[name], neutrals.dark[name]]
210
+ for (const role of SYNTAX_ROLES) {
211
+ const [light, dark] = [theme.syntax?.light?.[role], theme.syntax?.dark?.[role]]
212
+ if (light === undefined && dark === undefined) continue
213
+ const name = `color-syntax-${role}`
214
+ const { tokens } = groupOf(data, name)
215
+ tokens[name] = [light ?? valueFor(tokens, name, LIGHT), dark ?? valueFor(tokens, name, DARK)]
216
+ }
202
217
  return withReadableText(data)
203
218
  }
204
219
 
@@ -294,8 +309,10 @@ export const CHECKS = [
294
309
  ...STATUS.flatMap((tone) => on([statusInk(tone)], [mix(`{${tone}}`, 22, '{color-surface-raised}')])),
295
310
  ...on([statusInk('color-error')], ['{color-error-surface}', ...[10, 16].map((share) => mix('{color-error}', share, '{color-error-surface}'))]),
296
311
  ] },
312
+ // Core unless a theme sets a role, or the role follows a theme input such as the muted text; the mapper reports
313
+ // those pairs as the theme's.
297
314
  { id: 'syntax', label: 'Syntax colours on a code block', min: 4.5, kind: 'core',
298
- pairs: on(['keyword', 'string', 'number', 'comment'].map((role) => `{color-syntax-${role}}`), ['{color-code}']) },
315
+ pairs: on(SYNTAX_ROLES.map((role) => `{color-syntax-${role}}`), ['{color-code}']) },
299
316
  { id: 'command', label: 'Text and captions on the command plate', min: 4.5, kind: 'core',
300
317
  pairs: on(['{color-terminal-text}', '{color-terminal-caption-text}'], ['{color-command-bg}', mix('{color-command-bg}', 55, '{color-terminal}')]) },
301
318
  ]
@@ -10,11 +10,13 @@
10
10
  * theme then never counts as high contrast. Many theme files leave the type to the extension manifest's `uiTheme`;
11
11
  * translate it: `vs` is `light`, `vs-dark` is `dark`, `hc-black` is `hc`, and `hc-light` is `hcLight`.
12
12
  * @property {Record<string, unknown>} [colors] Workbench colours by key, as #rgb, #rgba, #rrggbb, or #rrggbbaa.
13
+ * @property {unknown[]} [tokenColors] TextMate rules, `{ scope, settings: { foreground } }`. Merge an `include`'s
14
+ * rules first, so the including file's rules come later and win.
13
15
  */
14
16
  /**
15
17
  * A contrast check the mapped theme fails in its mode. A `theme` problem is in the theme's own colours, or a
16
- * colour that follows them. A `core` problem is a core colour, such as a link, status, or syntax colour, on the
17
- * theme's fills: the theme cannot fix it.
18
+ * colour that follows them, such as a syntax colour the theme sets. A `core` problem is a core colour, such as a
19
+ * link, status, or core syntax colour, on the theme's fills: the theme cannot fix it. One check can report both.
18
20
  * @typedef {object} Problem
19
21
  * @property {'theme' | 'core'} kind
20
22
  * @property {string} check The check's id.
@@ -32,15 +34,17 @@
32
34
  * @property {string} hue `--color-project`.
33
35
  * @property {string} hueOnDark `--color-project-dark`: the prompt on the command plate, which is dark in both modes.
34
36
  * @property {Record<string, string>} neutrals Every neutral token, by name, such as `color-bg`.
37
+ * @property {Record<string, string>} syntax The syntax colours the theme sets, by role, such as `comment`. A role
38
+ * it leaves out stays core.
35
39
  * @property {Problem[]} problems Every check the theme fails after selection.
36
40
  */
37
- /** @typedef {Pick<MappedTheme, 'appearance' | 'hue' | 'hueOnDark' | 'neutrals'>} ThemeColours */
41
+ /** @typedef {Pick<MappedTheme, 'appearance' | 'hue' | 'hueOnDark' | 'neutrals'> & { syntax?: Record<string, string> }} ThemeColours */
38
42
  /** A theme that cannot be mapped, or mapped values that are not safe to set. */
39
43
  export class ThemeValidationError extends Error {
40
44
  /** @param {string} message */
41
45
  constructor(message: string);
42
46
  }
43
- export function themeInputs({ hue, hueOnDark, neutrals }: ThemeColours): ThemeInputs;
47
+ export function themeInputs({ hue, hueOnDark, neutrals, syntax }: ThemeColours): ThemeInputs;
44
48
  export function mapVsCodeTheme(theme: VsCodeTheme): MappedTheme;
45
49
  export function themeVariables(theme: ThemeColours): Record<string, string>;
46
50
  export type Colour = import("./engine.js").Colour;
@@ -65,11 +69,16 @@ export type VsCodeTheme = {
65
69
  * Workbench colours by key, as #rgb, #rgba, #rrggbb, or #rrggbbaa.
66
70
  */
67
71
  colors?: Record<string, unknown> | undefined;
72
+ /**
73
+ * TextMate rules, `{ scope, settings: { foreground } }`. Merge an `include`'s
74
+ * rules first, so the including file's rules come later and win.
75
+ */
76
+ tokenColors?: unknown[] | undefined;
68
77
  };
69
78
  /**
70
79
  * A contrast check the mapped theme fails in its mode. A `theme` problem is in the theme's own colours, or a
71
- * colour that follows them. A `core` problem is a core colour, such as a link, status, or syntax colour, on the
72
- * theme's fills: the theme cannot fix it.
80
+ * colour that follows them, such as a syntax colour the theme sets. A `core` problem is a core colour, such as a
81
+ * link, status, or core syntax colour, on the theme's fills: the theme cannot fix it. One check can report both.
73
82
  */
74
83
  export type Problem = {
75
84
  kind: "theme" | "core";
@@ -116,9 +125,16 @@ export type MappedTheme = {
116
125
  * Every neutral token, by name, such as `color-bg`.
117
126
  */
118
127
  neutrals: Record<string, string>;
128
+ /**
129
+ * The syntax colours the theme sets, by role, such as `comment`. A role
130
+ * it leaves out stays core.
131
+ */
132
+ syntax: Record<string, string>;
119
133
  /**
120
134
  * Every check the theme fails after selection.
121
135
  */
122
136
  problems: Problem[];
123
137
  };
124
- export type ThemeColours = Pick<MappedTheme, "appearance" | "hue" | "hueOnDark" | "neutrals">;
138
+ export type ThemeColours = Pick<MappedTheme, "appearance" | "hue" | "hueOnDark" | "neutrals"> & {
139
+ syntax?: Record<string, string>;
140
+ };
@@ -2,7 +2,7 @@
2
2
  // each input takes the first key in its row whose colour passes the row's gate, and no colour is changed.
3
3
  // What still fails once every input is chosen goes to `problems`.
4
4
  import { core } from './core.js'
5
- import { CHECKS, NEUTRALS, TEXT_ON_FILL_TOKENS, applyTheme, measurePairs, over, parseColour, passes, ratio, resolveData } from './engine.js'
5
+ import { CHECKS, LIGHT, NEUTRALS, SYNTAX_ROLES, TEXT_ON_FILL_TOKENS, applyTheme, flatTokens, measurePairs, over, parseColour, passes, ratio, reference, resolveData, valueFor } from './engine.js'
6
6
 
7
7
  /** @typedef {import('./engine.js').Colour} Colour */
8
8
  /** @typedef {import('./engine.js').Mode} Mode */
@@ -17,11 +17,13 @@ import { CHECKS, NEUTRALS, TEXT_ON_FILL_TOKENS, applyTheme, measurePairs, over,
17
17
  * theme then never counts as high contrast. Many theme files leave the type to the extension manifest's `uiTheme`;
18
18
  * translate it: `vs` is `light`, `vs-dark` is `dark`, `hc-black` is `hc`, and `hc-light` is `hcLight`.
19
19
  * @property {Record<string, unknown>} [colors] Workbench colours by key, as #rgb, #rgba, #rrggbb, or #rrggbbaa.
20
+ * @property {unknown[]} [tokenColors] TextMate rules, `{ scope, settings: { foreground } }`. Merge an `include`'s
21
+ * rules first, so the including file's rules come later and win.
20
22
  */
21
23
  /**
22
24
  * A contrast check the mapped theme fails in its mode. A `theme` problem is in the theme's own colours, or a
23
- * colour that follows them. A `core` problem is a core colour, such as a link, status, or syntax colour, on the
24
- * theme's fills: the theme cannot fix it.
25
+ * colour that follows them, such as a syntax colour the theme sets. A `core` problem is a core colour, such as a
26
+ * link, status, or core syntax colour, on the theme's fills: the theme cannot fix it. One check can report both.
25
27
  * @typedef {object} Problem
26
28
  * @property {'theme' | 'core'} kind
27
29
  * @property {string} check The check's id.
@@ -39,9 +41,11 @@ import { CHECKS, NEUTRALS, TEXT_ON_FILL_TOKENS, applyTheme, measurePairs, over,
39
41
  * @property {string} hue `--color-project`.
40
42
  * @property {string} hueOnDark `--color-project-dark`: the prompt on the command plate, which is dark in both modes.
41
43
  * @property {Record<string, string>} neutrals Every neutral token, by name, such as `color-bg`.
44
+ * @property {Record<string, string>} syntax The syntax colours the theme sets, by role, such as `comment`. A role
45
+ * it leaves out stays core.
42
46
  * @property {Problem[]} problems Every check the theme fails after selection.
43
47
  */
44
- /** @typedef {Pick<MappedTheme, 'appearance' | 'hue' | 'hueOnDark' | 'neutrals'>} ThemeColours */
48
+ /** @typedef {Pick<MappedTheme, 'appearance' | 'hue' | 'hueOnDark' | 'neutrals'> & { syntax?: Record<string, string> }} ThemeColours */
45
49
 
46
50
  /** A theme that cannot be mapped, or mapped values that are not safe to set. */
47
51
  export class ThemeValidationError extends Error {
@@ -58,6 +62,63 @@ const WHITE = [255, 255, 255, 1]
58
62
  const BLACK = [0, 0, 0, 1]
59
63
  const HUE_KEYS = ['button.background', 'focusBorder', 'textLink.foreground', 'progressBar.background']
60
64
 
65
+ // Each syntax role's TextMate scope families. A scope takes the roles whose family matches it most closely, so
66
+ // `keyword.operator` is an operator, not a keyword.
67
+ /** @type {Record<string, string[]>} */
68
+ const SCOPE_FAMILIES = {
69
+ comment: ['comment'],
70
+ keyword: ['keyword', 'storage'],
71
+ string: ['string'],
72
+ number: ['constant.numeric', 'constant.language'],
73
+ function: ['entity.name.function', 'support.function'],
74
+ type: ['entity.name.type', 'entity.name.class', 'support.type', 'support.class'],
75
+ variable: ['variable'],
76
+ operator: ['keyword.operator'],
77
+ punctuation: ['punctuation'],
78
+ tag: ['entity.name.tag'],
79
+ attribute: ['entity.other.attribute-name'],
80
+ }
81
+ /**
82
+ * The roles a scope belongs to, by its closest family, with how many segments the scope adds to that family:
83
+ * `keyword.control` adds one to `keyword`.
84
+ * @param {string} scope
85
+ * @returns {{ role: string, extra: number }[]}
86
+ */
87
+ const rolesForScope = (scope) => {
88
+ const matches = SYNTAX_ROLES.map((role) => ({
89
+ role,
90
+ family: SCOPE_FAMILIES[role].filter((family) => scope === family || scope.startsWith(`${family}.`)).sort((a, b) => b.length - a.length)[0] ?? '',
91
+ }))
92
+ const closest = matches.map(({ family }) => family).reduce((a, b) => (b.length > a.length ? b : a))
93
+ if (closest === '') return []
94
+ const extra = scope.split('.').length - closest.split('.').length
95
+ return matches.filter(({ family }) => family.length === closest.length).map(({ role }) => ({ role, extra }))
96
+ }
97
+ /**
98
+ * Each role's raw colour from TextMate rules: the rule whose scope is nearest the role's family, so a theme's
99
+ * `keyword` colour wins over its `keyword.control.anchor.regexp` colour; a later rule wins a tie. A rule that is
100
+ * not readable is skipped, as a missing key is. A selector with context, such as `meta.tag string`, counts as
101
+ * its last scope.
102
+ * @param {unknown} rules
103
+ * @returns {Record<string, unknown>}
104
+ */
105
+ const syntaxColours = (rules) => {
106
+ /** @type {Record<string, { extra: number, foreground: unknown }>} */
107
+ const found = {}
108
+ for (const rule of Array.isArray(rules) ? rules : []) {
109
+ const foreground = rule?.settings?.foreground
110
+ const scopes = typeof rule?.scope === 'string' ? [rule.scope] : rule?.scope
111
+ // A colour that cannot be read is skipped before it can displace a readable rule.
112
+ if (readColour(foreground) === undefined || !Array.isArray(scopes)) continue
113
+ for (const selector of scopes.filter((scope) => typeof scope === 'string').flatMap((scope) => scope.split(','))) {
114
+ for (const { role, extra } of rolesForScope(selector.trim().split(/\s+/).at(-1) ?? '')) {
115
+ if (!(extra > (found[role]?.extra ?? Infinity))) found[role] = { extra, foreground }
116
+ }
117
+ }
118
+ }
119
+ return Object.fromEntries(Object.entries(found).map(([role, { foreground }]) => [role, foreground]))
120
+ }
121
+
61
122
  /**
62
123
  * A #rgb, #rgba, #rrggbb, or #rrggbbaa value as a colour; anything else is undefined, as a missing key is.
63
124
  * @param {unknown} value
@@ -89,7 +150,22 @@ const contrast = (ink, surfaces) => Math.min(...surfaces.map((surface) => ratio(
89
150
  * @param {ThemeColours} theme
90
151
  * @returns {ThemeInputs}
91
152
  */
92
- export const themeInputs = ({ hue, hueOnDark, neutrals }) => ({ hue: { light: hue, dark: hueOnDark }, neutrals: { light: neutrals, dark: neutrals } })
153
+ export const themeInputs = ({ hue, hueOnDark, neutrals, syntax = {} }) => ({
154
+ hue: { light: hue, dark: hueOnDark }, neutrals: { light: neutrals, dark: neutrals }, syntax: { light: syntax, dark: syntax },
155
+ })
156
+
157
+ /**
158
+ * Whether a token is a theme input or follows one through plain references, such as the muted syntax roles.
159
+ * @param {Record<string, import('./engine.js').TokenValue>} tokens
160
+ * @param {Set<string>} inputs
161
+ * @param {string} name
162
+ * @returns {boolean}
163
+ */
164
+ const followsInput = (tokens, inputs, name) => {
165
+ if (inputs.has(name)) return true
166
+ const target = valueFor(tokens, name, LIGHT).match(/^\{([\w-]+)\}$/)?.[1]
167
+ return target !== undefined && followsInput(tokens, inputs, target)
168
+ }
93
169
 
94
170
  /**
95
171
  * Each check that fails in the theme's mode, with the pairs that fail it.
@@ -98,11 +174,26 @@ export const themeInputs = ({ hue, hueOnDark, neutrals }) => ({ hue: { light: hu
98
174
  */
99
175
  const failures = (theme) => {
100
176
  const mode = theme.appearance
101
- const values = resolveData(applyTheme(core, themeInputs(theme)))[mode]
177
+ const data = applyTheme(core, themeInputs(theme))
178
+ const values = resolveData(data)[mode]
179
+ const tokens = flatTokens(data)
180
+ const inputs = new Set(['color-project', 'color-project-dark', ...NEUTRALS, ...Object.keys(theme.syntax ?? {}).map((role) => `color-syntax-${role}`)])
181
+ /**
182
+ * A core check's pair is the theme's when its ink is one token that is, or follows, a theme input.
183
+ * @param {'theme' | 'core'} kind
184
+ * @param {PairResult} pair
185
+ */
186
+ const kindOf = (kind, { ink }) => {
187
+ const name = ink.match(new RegExp(`^${reference.source}$`))?.[1]
188
+ return kind === 'core' && name !== undefined && followsInput(tokens, inputs, name) ? 'theme' : kind
189
+ }
102
190
  return CHECKS.flatMap(({ id, kind, min, pairs }) => {
103
191
  const measured = measurePairs(values, pairs, mode)
104
192
  const failing = measured.filter((pair) => !passes(pair.ratio, min))
105
- return failing.length === 0 ? [] : [{ kind, check: id, mode, ratio: Math.min(...measured.map((pair) => pair.ratio)), min, pairs: failing }]
193
+ return /** @type {const} */ (['theme', 'core']).flatMap((found) => {
194
+ const own = failing.filter((pair) => kindOf(kind, pair) === found)
195
+ return own.length === 0 ? [] : [{ kind: found, check: id, mode, ratio: Math.min(...own.map((pair) => pair.ratio)), min, pairs: own }]
196
+ })
106
197
  })
107
198
  }
108
199
  /**
@@ -131,11 +222,13 @@ export const mapVsCodeTheme = (theme) => {
131
222
  : ratio(WHITE, over(background, WHITE)) > ratio(BLACK, over(background, WHITE)) ? 'dark' : 'light'
132
223
  const bg = toHex(over(background, appearance === 'dark' ? BLACK : WHITE))
133
224
 
134
- /** @param {string} key Every other colour composites over the page. */
135
- const colour = (key) => {
136
- const value = readColour(colors[key])
225
+ /** @param {unknown} raw Every other colour composites over the page. */
226
+ const composite = (raw) => {
227
+ const value = readColour(raw)
137
228
  return value && toHex(over(value, parseColour(bg)))
138
229
  }
230
+ /** @param {string} key */
231
+ const colour = (key) => composite(colors[key])
139
232
  /**
140
233
  * The first key whose colour passes the gate.
141
234
  * @param {string[]} keys
@@ -212,6 +305,13 @@ export const mapVsCodeTheme = (theme) => {
212
305
  // Text also sits on core fills, such as status alerts. When no candidate reads on every fill, the first that reads
213
306
  // on the page stays and its failures are reported.
214
307
  const colours = readableEverywhere(texts, '{color-text}', withText) ?? withText(texts[0])
308
+ // Syntax colours are the author's, kept as they are; the checks report the ones that fail.
309
+ /** @type {Record<string, string>} */
310
+ const syntax = {}
311
+ for (const [role, raw] of Object.entries(syntaxColours(theme.tokenColors))) {
312
+ const value = composite(raw)
313
+ if (value !== undefined) syntax[role] = value
314
+ }
215
315
  return {
216
316
  name: typeof theme.name === 'string' ? theme.name : '',
217
317
  appearance,
@@ -219,7 +319,8 @@ export const mapVsCodeTheme = (theme) => {
219
319
  hue: colours.hue,
220
320
  hueOnDark: colours.hueOnDark,
221
321
  neutrals: colours.neutrals,
222
- problems: failures(colours),
322
+ syntax,
323
+ problems: failures({ ...colours, syntax }),
223
324
  }
224
325
  }
225
326
 
@@ -227,22 +328,32 @@ const HEX = /^#[\da-f]{6}$/i
227
328
 
228
329
  /**
229
330
  * The CSS custom properties a mapped theme sets, by name with their dashes: the hue pair, the neutrals,
230
- * and the text on the selected fills, as the engine resolves them in the theme's mode. Set them as inline
331
+ * the text on the selected fills, and every syntax colour, as the engine resolves them in the theme's mode. Each
332
+ * theme sets the same properties, so applying one replaces the last; a syntax role the theme leaves out takes
333
+ * its core colour. Set them as inline
231
334
  * properties on the root element, with `data-theme` forced to the theme's appearance. Experimental.
232
335
  * @param {ThemeColours} theme
233
336
  * @returns {Record<string, string>}
234
- * @throws {ThemeValidationError} When the theme is not an object, its mode is not light or dark, or a colour is
235
- * not #rrggbb.
337
+ * @throws {ThemeValidationError} When the theme is not an object, its mode is not light or dark, a syntax role is
338
+ * unknown, or a colour is not #rrggbb.
236
339
  */
237
340
  export const themeVariables = (theme) => {
238
341
  // Persisted input may be anything, whatever its type says.
239
342
  if (typeof theme !== 'object' || theme === null) throw new ThemeValidationError('The theme is not an object')
240
- const { appearance, hue, hueOnDark, neutrals } = theme
343
+ const { appearance, hue, hueOnDark, neutrals, syntax = {} } = theme
241
344
  if (appearance !== 'light' && appearance !== 'dark') throw new ThemeValidationError('appearance is not light or dark')
242
- const colours = [['hue', hue], ['hueOnDark', hueOnDark], ...NEUTRALS.map((name) => [`neutrals["${name}"]`, neutrals?.[name]])]
345
+ if (typeof syntax !== 'object' || syntax === null) throw new ThemeValidationError('syntax is not an object')
346
+ const unknown = Object.keys(syntax).find((role) => !SYNTAX_ROLES.includes(role))
347
+ if (unknown !== undefined) throw new ThemeValidationError(`syntax["${unknown}"] is not a syntax role`)
348
+ const colours = [
349
+ ['hue', hue], ['hueOnDark', hueOnDark], ...NEUTRALS.map((name) => [`neutrals["${name}"]`, neutrals?.[name]]),
350
+ ...Object.entries(syntax).map(([role, value]) => [`syntax["${role}"]`, value]),
351
+ ]
243
352
  for (const [where, value] of colours) {
244
353
  if (typeof value !== 'string' || !HEX.test(value)) throw new ThemeValidationError(`${where} is not a #rrggbb colour`)
245
354
  }
246
355
  const values = resolveData(applyTheme(core, themeInputs(theme)))[appearance]
247
- return Object.fromEntries(['color-project', 'color-project-dark', ...NEUTRALS, ...TEXT_ON_FILL_TOKENS].map((name) => [`--${name}`, values[name]]))
356
+ return Object.fromEntries([
357
+ 'color-project', 'color-project-dark', ...NEUTRALS, ...TEXT_ON_FILL_TOKENS, ...SYNTAX_ROLES.map((role) => `color-syntax-${role}`),
358
+ ].map((name) => [`--${name}`, values[name]]))
248
359
  }