@loidolt/theme-tokens 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,6 +36,44 @@
36
36
  --loidolt-focus-ring: #f0895c;
37
37
  --loidolt-shadow-color: #000000;
38
38
  --loidolt-scrim: color-mix(in srgb, var(--loidolt-shadow-color) 78%, transparent);
39
+ --loidolt-chart-1: #e0672f;
40
+ --loidolt-chart-2: #6ea5bd;
41
+ --loidolt-chart-3: #93b287;
42
+ --loidolt-chart-4: #d9ab63;
43
+ --loidolt-chart-5: #c49ac0;
44
+ --loidolt-chart-6: #b8ad96;
45
+ --loidolt-chart-7: #6fb8a6;
46
+ --loidolt-chart-8: #c79a78;
47
+ --loidolt-chart-sequential-1: #3a2a1d;
48
+ --loidolt-chart-sequential-2: #6b4225;
49
+ --loidolt-chart-sequential-3: #a4602f;
50
+ --loidolt-chart-sequential-4: #d98a4d;
51
+ --loidolt-chart-sequential-5: #f2bd8a;
52
+ --loidolt-chart-diverging-1: #85b6ca;
53
+ --loidolt-chart-diverging-2: #5a8ea3;
54
+ --loidolt-chart-diverging-3: #35596a;
55
+ --loidolt-chart-diverging-4: #3a3d34;
56
+ --loidolt-chart-diverging-5: #7a4428;
57
+ --loidolt-chart-diverging-6: #bf6a3a;
58
+ --loidolt-chart-diverging-7: #f0895c;
59
+ --loidolt-chart-positive: #93b287;
60
+ --loidolt-chart-negative: #e88b81;
61
+ --loidolt-map-land: #161814;
62
+ --loidolt-map-water: #1d2b31;
63
+ --loidolt-map-park: #1f271c;
64
+ --loidolt-map-road: #2b2e26;
65
+ --loidolt-map-road-major: #3a3d34;
66
+ --loidolt-map-building: #24271f;
67
+ --loidolt-map-boundary: #787c6b;
68
+ --loidolt-map-label: #ebe7dc;
69
+ --loidolt-map-label-halo: #161814;
70
+ --loidolt-syntax-keyword: #a9441d;
71
+ --loidolt-syntax-string: #3f5139;
72
+ --loidolt-syntax-comment: #5f5b50;
73
+ --loidolt-syntax-constant: #7c4d17;
74
+ --loidolt-syntax-function: #265162;
75
+ --loidolt-syntax-parameter: #7a4a78;
76
+ --loidolt-syntax-punctuation: #474a42;
39
77
  }
40
78
 
41
79
  @media (prefers-color-scheme: dark) {
@@ -76,5 +114,43 @@
76
114
  --loidolt-focus-ring: #f0895c;
77
115
  --loidolt-shadow-color: #000000;
78
116
  --loidolt-scrim: color-mix(in srgb, var(--loidolt-shadow-color) 78%, transparent);
117
+ --loidolt-chart-1: #e0672f;
118
+ --loidolt-chart-2: #6ea5bd;
119
+ --loidolt-chart-3: #93b287;
120
+ --loidolt-chart-4: #d9ab63;
121
+ --loidolt-chart-5: #c49ac0;
122
+ --loidolt-chart-6: #b8ad96;
123
+ --loidolt-chart-7: #6fb8a6;
124
+ --loidolt-chart-8: #c79a78;
125
+ --loidolt-chart-sequential-1: #3a2a1d;
126
+ --loidolt-chart-sequential-2: #6b4225;
127
+ --loidolt-chart-sequential-3: #a4602f;
128
+ --loidolt-chart-sequential-4: #d98a4d;
129
+ --loidolt-chart-sequential-5: #f2bd8a;
130
+ --loidolt-chart-diverging-1: #85b6ca;
131
+ --loidolt-chart-diverging-2: #5a8ea3;
132
+ --loidolt-chart-diverging-3: #35596a;
133
+ --loidolt-chart-diverging-4: #3a3d34;
134
+ --loidolt-chart-diverging-5: #7a4428;
135
+ --loidolt-chart-diverging-6: #bf6a3a;
136
+ --loidolt-chart-diverging-7: #f0895c;
137
+ --loidolt-chart-positive: #93b287;
138
+ --loidolt-chart-negative: #e88b81;
139
+ --loidolt-map-land: #161814;
140
+ --loidolt-map-water: #1d2b31;
141
+ --loidolt-map-park: #1f271c;
142
+ --loidolt-map-road: #2b2e26;
143
+ --loidolt-map-road-major: #3a3d34;
144
+ --loidolt-map-building: #24271f;
145
+ --loidolt-map-boundary: #787c6b;
146
+ --loidolt-map-label: #ebe7dc;
147
+ --loidolt-map-label-halo: #161814;
148
+ --loidolt-syntax-keyword: #a9441d;
149
+ --loidolt-syntax-string: #3f5139;
150
+ --loidolt-syntax-comment: #5f5b50;
151
+ --loidolt-syntax-constant: #7c4d17;
152
+ --loidolt-syntax-function: #265162;
153
+ --loidolt-syntax-parameter: #7a4a78;
154
+ --loidolt-syntax-punctuation: #474a42;
79
155
  }
80
156
  }
package/dist/dark.css CHANGED
@@ -36,4 +36,42 @@
36
36
  --loidolt-focus-ring: #f0895c;
37
37
  --loidolt-shadow-color: #000000;
38
38
  --loidolt-scrim: color-mix(in srgb, var(--loidolt-shadow-color) 78%, transparent);
39
+ --loidolt-chart-1: #e0672f;
40
+ --loidolt-chart-2: #6ea5bd;
41
+ --loidolt-chart-3: #93b287;
42
+ --loidolt-chart-4: #d9ab63;
43
+ --loidolt-chart-5: #c49ac0;
44
+ --loidolt-chart-6: #b8ad96;
45
+ --loidolt-chart-7: #6fb8a6;
46
+ --loidolt-chart-8: #c79a78;
47
+ --loidolt-chart-sequential-1: #3a2a1d;
48
+ --loidolt-chart-sequential-2: #6b4225;
49
+ --loidolt-chart-sequential-3: #a4602f;
50
+ --loidolt-chart-sequential-4: #d98a4d;
51
+ --loidolt-chart-sequential-5: #f2bd8a;
52
+ --loidolt-chart-diverging-1: #85b6ca;
53
+ --loidolt-chart-diverging-2: #5a8ea3;
54
+ --loidolt-chart-diverging-3: #35596a;
55
+ --loidolt-chart-diverging-4: #3a3d34;
56
+ --loidolt-chart-diverging-5: #7a4428;
57
+ --loidolt-chart-diverging-6: #bf6a3a;
58
+ --loidolt-chart-diverging-7: #f0895c;
59
+ --loidolt-chart-positive: #93b287;
60
+ --loidolt-chart-negative: #e88b81;
61
+ --loidolt-map-land: #161814;
62
+ --loidolt-map-water: #1d2b31;
63
+ --loidolt-map-park: #1f271c;
64
+ --loidolt-map-road: #2b2e26;
65
+ --loidolt-map-road-major: #3a3d34;
66
+ --loidolt-map-building: #24271f;
67
+ --loidolt-map-boundary: #787c6b;
68
+ --loidolt-map-label: #ebe7dc;
69
+ --loidolt-map-label-halo: #161814;
70
+ --loidolt-syntax-keyword: #a9441d;
71
+ --loidolt-syntax-string: #3f5139;
72
+ --loidolt-syntax-comment: #5f5b50;
73
+ --loidolt-syntax-constant: #7c4d17;
74
+ --loidolt-syntax-function: #265162;
75
+ --loidolt-syntax-parameter: #7a4a78;
76
+ --loidolt-syntax-punctuation: #474a42;
39
77
  }
package/dist/index.d.ts CHANGED
@@ -61,7 +61,10 @@ declare function getContrastTextColor(background: string, { dark, light }?: {
61
61
  type TokenRef = {
62
62
  readonly $ref: string;
63
63
  };
64
- /** `['font', 'lineHeight', 'tight']` → `--loidolt-font-line-height-tight`. */
64
+ /**
65
+ * `['font', 'lineHeight', 'tight']` → `--loidolt-font-line-height-tight`; a trailing number is its
66
+ * own segment, so `chart1` → `--loidolt-chart-1`.
67
+ */
65
68
  declare const cssVarName: (path: readonly string[]) => string;
66
69
  declare const colors: {
67
70
  readonly paper: "#ebe7dc";
@@ -82,6 +85,59 @@ declare const colors: {
82
85
  readonly success: "#3f5139";
83
86
  readonly warning: "#7c4d17";
84
87
  readonly info: "#265162";
88
+ /**
89
+ * Categorical series for charts, in the order they are handed out. Earth tones that stay apart
90
+ * from each other and hold 3:1 against every surface, so a line or bar needs no outline.
91
+ */
92
+ readonly series: {
93
+ readonly 1: "#c65224";
94
+ readonly 2: "#2f6f8a";
95
+ readonly 3: "#5b7a3a";
96
+ readonly 4: "#9a6a12";
97
+ readonly 5: "#7a4a78";
98
+ readonly 6: "#4d5a6a";
99
+ readonly 7: "#2f7d6d";
100
+ readonly 8: "#8a5a3c";
101
+ };
102
+ /** One warm hue from little to most: heatmaps, choropleths, cluster sizes. */
103
+ readonly sequential: {
104
+ readonly 1: "#ecd3b8";
105
+ readonly 2: "#dea67a";
106
+ readonly 3: "#c97a45";
107
+ readonly 4: "#a4521f";
108
+ readonly 5: "#6e3314";
109
+ };
110
+ /** Below and above a midpoint: slate for below, orange for above, the neutral paper between. */
111
+ readonly diverging: {
112
+ readonly 1: "#265162";
113
+ readonly 2: "#4f8196";
114
+ readonly 3: "#9cbac3";
115
+ readonly 4: "#ddd7c9";
116
+ readonly 5: "#e0a986";
117
+ readonly 6: "#c96f3d";
118
+ readonly 7: "#9b3a17";
119
+ };
120
+ /**
121
+ * Code highlighting. Code sits on the inverse surface — dark in the light theme — so these are
122
+ * the light inks; the dark theme's code block is light, and takes dark ones.
123
+ */
124
+ readonly syntax: {
125
+ readonly keyword: "#f0895c";
126
+ readonly string: "#a3c197";
127
+ readonly comment: "#b5ae9c";
128
+ readonly constant: "#e2b56c";
129
+ readonly function: "#8fc0d4";
130
+ readonly parameter: "#d3a8cf";
131
+ readonly punctuation: "#d8d2c4";
132
+ };
133
+ /** Basemap fills. Quiet by design: the data drawn on top carries the colour. */
134
+ readonly map: {
135
+ readonly water: "#b9cdd3";
136
+ readonly park: "#d3d8bd";
137
+ readonly road: "#f5f2e9";
138
+ readonly roadMajor: "#ffffff";
139
+ readonly building: "#d8d3c7";
140
+ };
85
141
  };
86
142
  declare const typography: {
87
143
  readonly display: "\"Jost\", \"Avenir Next\", sans-serif";
@@ -224,6 +280,45 @@ declare const semanticDefs: {
224
280
  readonly focusRing: TokenRef;
225
281
  readonly shadowColor: TokenRef;
226
282
  readonly scrim: "color-mix(in srgb, var(--loidolt-shadow-color) 72%, transparent)";
283
+ readonly chart1: TokenRef;
284
+ readonly chart2: TokenRef;
285
+ readonly chart3: TokenRef;
286
+ readonly chart4: TokenRef;
287
+ readonly chart5: TokenRef;
288
+ readonly chart6: TokenRef;
289
+ readonly chart7: TokenRef;
290
+ readonly chart8: TokenRef;
291
+ readonly chartSequential1: TokenRef;
292
+ readonly chartSequential2: TokenRef;
293
+ readonly chartSequential3: TokenRef;
294
+ readonly chartSequential4: TokenRef;
295
+ readonly chartSequential5: TokenRef;
296
+ readonly chartDiverging1: TokenRef;
297
+ readonly chartDiverging2: TokenRef;
298
+ readonly chartDiverging3: TokenRef;
299
+ readonly chartDiverging4: TokenRef;
300
+ readonly chartDiverging5: TokenRef;
301
+ readonly chartDiverging6: TokenRef;
302
+ readonly chartDiverging7: TokenRef;
303
+ /** Gains and losses: candlestick up/down, positive/negative bars. */
304
+ readonly chartPositive: TokenRef;
305
+ readonly chartNegative: TokenRef;
306
+ readonly mapLand: TokenRef;
307
+ readonly mapWater: TokenRef;
308
+ readonly mapPark: TokenRef;
309
+ readonly mapRoad: TokenRef;
310
+ readonly mapRoadMajor: TokenRef;
311
+ readonly mapBuilding: TokenRef;
312
+ readonly mapBoundary: TokenRef;
313
+ readonly mapLabel: TokenRef;
314
+ readonly mapLabelHalo: TokenRef;
315
+ readonly syntaxKeyword: TokenRef;
316
+ readonly syntaxString: TokenRef;
317
+ readonly syntaxComment: TokenRef;
318
+ readonly syntaxConstant: TokenRef;
319
+ readonly syntaxFunction: TokenRef;
320
+ readonly syntaxParameter: TokenRef;
321
+ readonly syntaxPunctuation: TokenRef;
227
322
  };
228
323
  /** Every custom property the package emits, in declaration order. */
229
324
  declare function flattenTokens(): Array<[string, string | TokenRef]>;
@@ -276,7 +371,121 @@ declare const darkSemantic: {
276
371
  readonly focusRing: "#f0895c";
277
372
  readonly shadowColor: "#000000";
278
373
  readonly scrim: "color-mix(in srgb, var(--loidolt-shadow-color) 78%, transparent)";
374
+ readonly chart1: "#e0672f";
375
+ readonly chart2: "#6ea5bd";
376
+ readonly chart3: "#93b287";
377
+ readonly chart4: "#d9ab63";
378
+ readonly chart5: "#c49ac0";
379
+ readonly chart6: "#b8ad96";
380
+ readonly chart7: "#6fb8a6";
381
+ readonly chart8: "#c79a78";
382
+ readonly chartSequential1: "#3a2a1d";
383
+ readonly chartSequential2: "#6b4225";
384
+ readonly chartSequential3: "#a4602f";
385
+ readonly chartSequential4: "#d98a4d";
386
+ readonly chartSequential5: "#f2bd8a";
387
+ readonly chartDiverging1: "#85b6ca";
388
+ readonly chartDiverging2: "#5a8ea3";
389
+ readonly chartDiverging3: "#35596a";
390
+ readonly chartDiverging4: "#3a3d34";
391
+ readonly chartDiverging5: "#7a4428";
392
+ readonly chartDiverging6: "#bf6a3a";
393
+ readonly chartDiverging7: "#f0895c";
394
+ readonly chartPositive: "#93b287";
395
+ readonly chartNegative: "#e88b81";
396
+ readonly mapLand: "#161814";
397
+ readonly mapWater: "#1d2b31";
398
+ readonly mapPark: "#1f271c";
399
+ readonly mapRoad: "#2b2e26";
400
+ readonly mapRoadMajor: "#3a3d34";
401
+ readonly mapBuilding: "#24271f";
402
+ readonly mapBoundary: "#787c6b";
403
+ readonly mapLabel: "#ebe7dc";
404
+ readonly mapLabelHalo: "#161814";
405
+ readonly syntaxKeyword: "#a9441d";
406
+ readonly syntaxString: "#3f5139";
407
+ readonly syntaxComment: "#5f5b50";
408
+ readonly syntaxConstant: "#7c4d17";
409
+ readonly syntaxFunction: "#265162";
410
+ readonly syntaxParameter: "#7a4a78";
411
+ readonly syntaxPunctuation: "#474a42";
412
+ };
413
+ type ColorScheme = 'light' | 'dark';
414
+ type SemanticRole = keyof typeof semanticDefs;
415
+ /** The custom property a semantic role is published as: `chart1` → `--loidolt-chart-1`. */
416
+ declare const roleVar: (role: SemanticRole) => string;
417
+ /**
418
+ * A role's concrete value in the reference light or dark theme. Canvas and WebGL renderers cannot
419
+ * read `var()`, and neither can the server: this is what they fall back to when the live value
420
+ * cannot be read from the page.
421
+ */
422
+ declare const roleValue: (role: SemanticRole, scheme?: ColorScheme) => string;
423
+ /** Names roles — singly or as an ordered list — under keys a renderer understands. */
424
+ type RoleSpec = {
425
+ readonly [key: string]: SemanticRole | readonly SemanticRole[];
426
+ };
427
+ type ResolvedRoles<S extends RoleSpec> = {
428
+ -readonly [K in keyof S]: S[K] extends readonly SemanticRole[] ? string[] : string;
279
429
  };
430
+ /**
431
+ * Resolves every role in `spec`. `read` defaults to the reference theme; a runtime passes one
432
+ * that reads the page, so a consumer's own theme reaches the canvas too.
433
+ */
434
+ declare function resolveRoles<S extends RoleSpec>(spec: S, scheme?: ColorScheme, read?: (role: SemanticRole) => string): ResolvedRoles<S>;
435
+ /** The roles a chart is painted with. */
436
+ declare const chartRoles: {
437
+ readonly categorical: readonly ["chart1", "chart2", "chart3", "chart4", "chart5", "chart6", "chart7", "chart8"];
438
+ readonly sequential: readonly ["chartSequential1", "chartSequential2", "chartSequential3", "chartSequential4", "chartSequential5"];
439
+ readonly diverging: readonly ["chartDiverging1", "chartDiverging2", "chartDiverging3", "chartDiverging4", "chartDiverging5", "chartDiverging6", "chartDiverging7"];
440
+ readonly positive: "chartPositive";
441
+ readonly negative: "chartNegative";
442
+ readonly text: "text";
443
+ readonly muted: "textMuted";
444
+ readonly axis: "border";
445
+ readonly grid: "borderSoft";
446
+ readonly surface: "surface";
447
+ readonly background: "background";
448
+ readonly accent: "accent";
449
+ };
450
+ /** The roles a basemap and map overlays are painted with. */
451
+ declare const mapRoles: {
452
+ readonly land: "mapLand";
453
+ readonly water: "mapWater";
454
+ readonly park: "mapPark";
455
+ readonly road: "mapRoad";
456
+ readonly roadMajor: "mapRoadMajor";
457
+ readonly building: "mapBuilding";
458
+ readonly boundary: "mapBoundary";
459
+ readonly label: "mapLabel";
460
+ readonly labelHalo: "mapLabelHalo";
461
+ readonly accent: "accent";
462
+ readonly text: "text";
463
+ readonly surface: "surface";
464
+ readonly focus: "focusRing";
465
+ readonly categorical: readonly ["chart1", "chart2", "chart3", "chart4", "chart5", "chart6", "chart7", "chart8"];
466
+ readonly sequential: readonly ["chartSequential1", "chartSequential2", "chartSequential3", "chartSequential4", "chartSequential5"];
467
+ };
468
+ /** The roles code is highlighted with, and the surface it sits on. */
469
+ declare const syntaxRoles: {
470
+ readonly background: "surfaceInverse";
471
+ readonly text: "textInverse";
472
+ readonly keyword: "syntaxKeyword";
473
+ readonly string: "syntaxString";
474
+ readonly comment: "syntaxComment";
475
+ readonly constant: "syntaxConstant";
476
+ readonly function: "syntaxFunction";
477
+ readonly parameter: "syntaxParameter";
478
+ readonly punctuation: "syntaxPunctuation";
479
+ };
480
+ type SyntaxColors = ResolvedRoles<typeof syntaxRoles>;
481
+ /** Syntax colours in the reference theme. */
482
+ declare const syntaxColors: (scheme?: ColorScheme) => SyntaxColors;
483
+ type ChartColors = ResolvedRoles<typeof chartRoles>;
484
+ type MapColors = ResolvedRoles<typeof mapRoles>;
485
+ /** Chart colours in the reference theme. */
486
+ declare const chartColors: (scheme?: ColorScheme) => ChartColors;
487
+ /** Map colours in the reference theme. */
488
+ declare const mapColors: (scheme?: ColorScheme) => MapColors;
280
489
  /**
281
490
  * Dark theme CSS. `scope` picks how it activates:
282
491
  * - `attribute` (default): `[data-theme='dark']` only — the app drives it.
@@ -304,6 +513,59 @@ declare const tokens: {
304
513
  readonly success: "#3f5139";
305
514
  readonly warning: "#7c4d17";
306
515
  readonly info: "#265162";
516
+ /**
517
+ * Categorical series for charts, in the order they are handed out. Earth tones that stay apart
518
+ * from each other and hold 3:1 against every surface, so a line or bar needs no outline.
519
+ */
520
+ readonly series: {
521
+ readonly 1: "#c65224";
522
+ readonly 2: "#2f6f8a";
523
+ readonly 3: "#5b7a3a";
524
+ readonly 4: "#9a6a12";
525
+ readonly 5: "#7a4a78";
526
+ readonly 6: "#4d5a6a";
527
+ readonly 7: "#2f7d6d";
528
+ readonly 8: "#8a5a3c";
529
+ };
530
+ /** One warm hue from little to most: heatmaps, choropleths, cluster sizes. */
531
+ readonly sequential: {
532
+ readonly 1: "#ecd3b8";
533
+ readonly 2: "#dea67a";
534
+ readonly 3: "#c97a45";
535
+ readonly 4: "#a4521f";
536
+ readonly 5: "#6e3314";
537
+ };
538
+ /** Below and above a midpoint: slate for below, orange for above, the neutral paper between. */
539
+ readonly diverging: {
540
+ readonly 1: "#265162";
541
+ readonly 2: "#4f8196";
542
+ readonly 3: "#9cbac3";
543
+ readonly 4: "#ddd7c9";
544
+ readonly 5: "#e0a986";
545
+ readonly 6: "#c96f3d";
546
+ readonly 7: "#9b3a17";
547
+ };
548
+ /**
549
+ * Code highlighting. Code sits on the inverse surface — dark in the light theme — so these are
550
+ * the light inks; the dark theme's code block is light, and takes dark ones.
551
+ */
552
+ readonly syntax: {
553
+ readonly keyword: "#f0895c";
554
+ readonly string: "#a3c197";
555
+ readonly comment: "#b5ae9c";
556
+ readonly constant: "#e2b56c";
557
+ readonly function: "#8fc0d4";
558
+ readonly parameter: "#d3a8cf";
559
+ readonly punctuation: "#d8d2c4";
560
+ };
561
+ /** Basemap fills. Quiet by design: the data drawn on top carries the colour. */
562
+ readonly map: {
563
+ readonly water: "#b9cdd3";
564
+ readonly park: "#d3d8bd";
565
+ readonly road: "#f5f2e9";
566
+ readonly roadMajor: "#ffffff";
567
+ readonly building: "#d8d3c7";
568
+ };
307
569
  };
308
570
  readonly typography: {
309
571
  readonly display: "\"Jost\", \"Avenir Next\", sans-serif";
@@ -426,6 +688,44 @@ declare const tokens: {
426
688
  readonly focusRing: string;
427
689
  readonly shadowColor: string;
428
690
  readonly scrim: string;
691
+ readonly chart1: string;
692
+ readonly chart2: string;
693
+ readonly chart3: string;
694
+ readonly chart4: string;
695
+ readonly chart5: string;
696
+ readonly chart6: string;
697
+ readonly chart7: string;
698
+ readonly chart8: string;
699
+ readonly chartSequential1: string;
700
+ readonly chartSequential2: string;
701
+ readonly chartSequential3: string;
702
+ readonly chartSequential4: string;
703
+ readonly chartSequential5: string;
704
+ readonly chartDiverging1: string;
705
+ readonly chartDiverging2: string;
706
+ readonly chartDiverging3: string;
707
+ readonly chartDiverging4: string;
708
+ readonly chartDiverging5: string;
709
+ readonly chartDiverging6: string;
710
+ readonly chartDiverging7: string;
711
+ readonly chartPositive: string;
712
+ readonly chartNegative: string;
713
+ readonly mapLand: string;
714
+ readonly mapWater: string;
715
+ readonly mapPark: string;
716
+ readonly mapRoad: string;
717
+ readonly mapRoadMajor: string;
718
+ readonly mapBuilding: string;
719
+ readonly mapBoundary: string;
720
+ readonly mapLabel: string;
721
+ readonly mapLabelHalo: string;
722
+ readonly syntaxKeyword: string;
723
+ readonly syntaxString: string;
724
+ readonly syntaxComment: string;
725
+ readonly syntaxConstant: string;
726
+ readonly syntaxFunction: string;
727
+ readonly syntaxParameter: string;
728
+ readonly syntaxPunctuation: string;
429
729
  };
430
730
  readonly darkSemantic: {
431
731
  readonly background: "#161814";
@@ -463,8 +763,46 @@ declare const tokens: {
463
763
  readonly focusRing: "#f0895c";
464
764
  readonly shadowColor: "#000000";
465
765
  readonly scrim: "color-mix(in srgb, var(--loidolt-shadow-color) 78%, transparent)";
766
+ readonly chart1: "#e0672f";
767
+ readonly chart2: "#6ea5bd";
768
+ readonly chart3: "#93b287";
769
+ readonly chart4: "#d9ab63";
770
+ readonly chart5: "#c49ac0";
771
+ readonly chart6: "#b8ad96";
772
+ readonly chart7: "#6fb8a6";
773
+ readonly chart8: "#c79a78";
774
+ readonly chartSequential1: "#3a2a1d";
775
+ readonly chartSequential2: "#6b4225";
776
+ readonly chartSequential3: "#a4602f";
777
+ readonly chartSequential4: "#d98a4d";
778
+ readonly chartSequential5: "#f2bd8a";
779
+ readonly chartDiverging1: "#85b6ca";
780
+ readonly chartDiverging2: "#5a8ea3";
781
+ readonly chartDiverging3: "#35596a";
782
+ readonly chartDiverging4: "#3a3d34";
783
+ readonly chartDiverging5: "#7a4428";
784
+ readonly chartDiverging6: "#bf6a3a";
785
+ readonly chartDiverging7: "#f0895c";
786
+ readonly chartPositive: "#93b287";
787
+ readonly chartNegative: "#e88b81";
788
+ readonly mapLand: "#161814";
789
+ readonly mapWater: "#1d2b31";
790
+ readonly mapPark: "#1f271c";
791
+ readonly mapRoad: "#2b2e26";
792
+ readonly mapRoadMajor: "#3a3d34";
793
+ readonly mapBuilding: "#24271f";
794
+ readonly mapBoundary: "#787c6b";
795
+ readonly mapLabel: "#ebe7dc";
796
+ readonly mapLabelHalo: "#161814";
797
+ readonly syntaxKeyword: "#a9441d";
798
+ readonly syntaxString: "#3f5139";
799
+ readonly syntaxComment: "#5f5b50";
800
+ readonly syntaxConstant: "#7c4d17";
801
+ readonly syntaxFunction: "#265162";
802
+ readonly syntaxParameter: "#7a4a78";
803
+ readonly syntaxPunctuation: "#474a42";
466
804
  };
467
805
  };
468
806
  type ThemeTokens = typeof tokens;
469
807
 
470
- export { type ContrastLevel, type ContrastValidation, type TextSize, type ThemeTokens, type TokenRef, aspectRatio, borders, breakpoints, colors, contrastRequirements, cssVarName, darkSemantic, tokens as default, flattenTokens, generateCss, generateDarkCss, getContrastRatio, getContrastTextColor, getLuminance, meetsContrast, motion, semantic, shadows, sizing, spacing, tokens, typography, validateContrast, zIndex };
808
+ export { type ChartColors, type ColorScheme, type ContrastLevel, type ContrastValidation, type MapColors, type ResolvedRoles, type RoleSpec, type SemanticRole, type SyntaxColors, type TextSize, type ThemeTokens, type TokenRef, aspectRatio, borders, breakpoints, chartColors, chartRoles, colors, contrastRequirements, cssVarName, darkSemantic, tokens as default, flattenTokens, generateCss, generateDarkCss, getContrastRatio, getContrastTextColor, getLuminance, mapColors, mapRoles, meetsContrast, motion, resolveRoles, roleValue, roleVar, semantic, shadows, sizing, spacing, syntaxColors, syntaxRoles, tokens, typography, validateContrast, zIndex };
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ function getContrastTextColor(background, { dark = "#20231d", light = "#f5f2e9"
44
44
  // src/index.ts
45
45
  var ref = (name) => ({ $ref: `--loidolt-${name}` });
46
46
  var isRef = (value) => typeof value === "object" && value !== null && "$ref" in value;
47
- var kebab = (value) => value.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
47
+ var kebab = (value) => value.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`).replace(/([a-z])(\d)/g, "$1-$2");
48
48
  var cssVarName = (path) => `--loidolt-${kebab(path.join("-"))}`;
49
49
  var colors = {
50
50
  paper: "#ebe7dc",
@@ -66,7 +66,60 @@ var colors = {
66
66
  errorDark: "#7f1f1a",
67
67
  success: "#3f5139",
68
68
  warning: "#7c4d17",
69
- info: "#265162"
69
+ info: "#265162",
70
+ /**
71
+ * Categorical series for charts, in the order they are handed out. Earth tones that stay apart
72
+ * from each other and hold 3:1 against every surface, so a line or bar needs no outline.
73
+ */
74
+ series: {
75
+ 1: "#c65224",
76
+ 2: "#2f6f8a",
77
+ 3: "#5b7a3a",
78
+ 4: "#9a6a12",
79
+ 5: "#7a4a78",
80
+ 6: "#4d5a6a",
81
+ 7: "#2f7d6d",
82
+ 8: "#8a5a3c"
83
+ },
84
+ /** One warm hue from little to most: heatmaps, choropleths, cluster sizes. */
85
+ sequential: {
86
+ 1: "#ecd3b8",
87
+ 2: "#dea67a",
88
+ 3: "#c97a45",
89
+ 4: "#a4521f",
90
+ 5: "#6e3314"
91
+ },
92
+ /** Below and above a midpoint: slate for below, orange for above, the neutral paper between. */
93
+ diverging: {
94
+ 1: "#265162",
95
+ 2: "#4f8196",
96
+ 3: "#9cbac3",
97
+ 4: "#ddd7c9",
98
+ 5: "#e0a986",
99
+ 6: "#c96f3d",
100
+ 7: "#9b3a17"
101
+ },
102
+ /**
103
+ * Code highlighting. Code sits on the inverse surface — dark in the light theme — so these are
104
+ * the light inks; the dark theme's code block is light, and takes dark ones.
105
+ */
106
+ syntax: {
107
+ keyword: "#f0895c",
108
+ string: "#a3c197",
109
+ comment: "#b5ae9c",
110
+ constant: "#e2b56c",
111
+ function: "#8fc0d4",
112
+ parameter: "#d3a8cf",
113
+ punctuation: "#d8d2c4"
114
+ },
115
+ /** Basemap fills. Quiet by design: the data drawn on top carries the colour. */
116
+ map: {
117
+ water: "#b9cdd3",
118
+ park: "#d3d8bd",
119
+ road: "#f5f2e9",
120
+ roadMajor: "#ffffff",
121
+ building: "#d8d3c7"
122
+ }
70
123
  };
71
124
  var typography = {
72
125
  display: '"Jost", "Avenir Next", sans-serif',
@@ -181,7 +234,52 @@ var semanticDefs = {
181
234
  textInfo: ref("color-info"),
182
235
  focusRing: ref("color-orange"),
183
236
  shadowColor: ref("color-deep"),
184
- scrim: "color-mix(in srgb, var(--loidolt-shadow-color) 72%, transparent)"
237
+ scrim: "color-mix(in srgb, var(--loidolt-shadow-color) 72%, transparent)",
238
+ /*
239
+ * Data visualisation. `chart1`…`chart8` are categorical series; the ramps run from "least" (1)
240
+ * to "most" (last), whatever the theme; the diverging midpoint (4) is the neutral.
241
+ */
242
+ chart1: ref("color-series-1"),
243
+ chart2: ref("color-series-2"),
244
+ chart3: ref("color-series-3"),
245
+ chart4: ref("color-series-4"),
246
+ chart5: ref("color-series-5"),
247
+ chart6: ref("color-series-6"),
248
+ chart7: ref("color-series-7"),
249
+ chart8: ref("color-series-8"),
250
+ chartSequential1: ref("color-sequential-1"),
251
+ chartSequential2: ref("color-sequential-2"),
252
+ chartSequential3: ref("color-sequential-3"),
253
+ chartSequential4: ref("color-sequential-4"),
254
+ chartSequential5: ref("color-sequential-5"),
255
+ chartDiverging1: ref("color-diverging-1"),
256
+ chartDiverging2: ref("color-diverging-2"),
257
+ chartDiverging3: ref("color-diverging-3"),
258
+ chartDiverging4: ref("color-diverging-4"),
259
+ chartDiverging5: ref("color-diverging-5"),
260
+ chartDiverging6: ref("color-diverging-6"),
261
+ chartDiverging7: ref("color-diverging-7"),
262
+ /** Gains and losses: candlestick up/down, positive/negative bars. */
263
+ chartPositive: ref("color-success"),
264
+ chartNegative: ref("color-error"),
265
+ /* Basemap roles, read by the map style generator. */
266
+ mapLand: ref("color-paper"),
267
+ mapWater: ref("color-map-water"),
268
+ mapPark: ref("color-map-park"),
269
+ mapRoad: ref("color-map-road"),
270
+ mapRoadMajor: ref("color-map-road-major"),
271
+ mapBuilding: ref("color-map-building"),
272
+ mapBoundary: ref("color-line-strong"),
273
+ mapLabel: ref("color-deep"),
274
+ mapLabelHalo: ref("color-panel"),
275
+ /* Code highlighting, on the inverse surface where code blocks sit. */
276
+ syntaxKeyword: ref("color-syntax-keyword"),
277
+ syntaxString: ref("color-syntax-string"),
278
+ syntaxComment: ref("color-syntax-comment"),
279
+ syntaxConstant: ref("color-syntax-constant"),
280
+ syntaxFunction: ref("color-syntax-function"),
281
+ syntaxParameter: ref("color-syntax-parameter"),
282
+ syntaxPunctuation: ref("color-syntax-punctuation")
185
283
  };
186
284
  var PRIMITIVE_GROUPS = [
187
285
  ["color", colors],
@@ -262,8 +360,115 @@ var darkSemantic = {
262
360
  textInfo: "#85b6ca",
263
361
  focusRing: "#f0895c",
264
362
  shadowColor: "#000000",
265
- scrim: "color-mix(in srgb, var(--loidolt-shadow-color) 78%, transparent)"
363
+ scrim: "color-mix(in srgb, var(--loidolt-shadow-color) 78%, transparent)",
364
+ chart1: "#e0672f",
365
+ chart2: "#6ea5bd",
366
+ chart3: "#93b287",
367
+ chart4: "#d9ab63",
368
+ chart5: "#c49ac0",
369
+ chart6: "#b8ad96",
370
+ chart7: "#6fb8a6",
371
+ chart8: "#c79a78",
372
+ chartSequential1: "#3a2a1d",
373
+ chartSequential2: "#6b4225",
374
+ chartSequential3: "#a4602f",
375
+ chartSequential4: "#d98a4d",
376
+ chartSequential5: "#f2bd8a",
377
+ chartDiverging1: "#85b6ca",
378
+ chartDiverging2: "#5a8ea3",
379
+ chartDiverging3: "#35596a",
380
+ chartDiverging4: "#3a3d34",
381
+ chartDiverging5: "#7a4428",
382
+ chartDiverging6: "#bf6a3a",
383
+ chartDiverging7: "#f0895c",
384
+ chartPositive: "#93b287",
385
+ chartNegative: "#e88b81",
386
+ mapLand: "#161814",
387
+ mapWater: "#1d2b31",
388
+ mapPark: "#1f271c",
389
+ mapRoad: "#2b2e26",
390
+ mapRoadMajor: "#3a3d34",
391
+ mapBuilding: "#24271f",
392
+ mapBoundary: "#787c6b",
393
+ mapLabel: "#ebe7dc",
394
+ mapLabelHalo: "#161814",
395
+ syntaxKeyword: "#a9441d",
396
+ syntaxString: "#3f5139",
397
+ syntaxComment: "#5f5b50",
398
+ syntaxConstant: "#7c4d17",
399
+ syntaxFunction: "#265162",
400
+ syntaxParameter: "#7a4a78",
401
+ syntaxPunctuation: "#474a42"
402
+ };
403
+ var roleVar = (role) => cssVarName([role]);
404
+ var roleValue = (role, scheme = "light") => scheme === "dark" ? darkSemantic[role] : semantic[role];
405
+ function resolveRoles(spec, scheme = "light", read = (role) => roleValue(role, scheme)) {
406
+ return Object.fromEntries(
407
+ Object.entries(spec).map(([key, value]) => [
408
+ key,
409
+ typeof value === "string" ? read(value) : value.map((role) => read(role))
410
+ ])
411
+ );
412
+ }
413
+ var chartRoles = {
414
+ categorical: ["chart1", "chart2", "chart3", "chart4", "chart5", "chart6", "chart7", "chart8"],
415
+ sequential: [
416
+ "chartSequential1",
417
+ "chartSequential2",
418
+ "chartSequential3",
419
+ "chartSequential4",
420
+ "chartSequential5"
421
+ ],
422
+ diverging: [
423
+ "chartDiverging1",
424
+ "chartDiverging2",
425
+ "chartDiverging3",
426
+ "chartDiverging4",
427
+ "chartDiverging5",
428
+ "chartDiverging6",
429
+ "chartDiverging7"
430
+ ],
431
+ positive: "chartPositive",
432
+ negative: "chartNegative",
433
+ text: "text",
434
+ muted: "textMuted",
435
+ axis: "border",
436
+ grid: "borderSoft",
437
+ surface: "surface",
438
+ background: "background",
439
+ accent: "accent"
440
+ };
441
+ var mapRoles = {
442
+ land: "mapLand",
443
+ water: "mapWater",
444
+ park: "mapPark",
445
+ road: "mapRoad",
446
+ roadMajor: "mapRoadMajor",
447
+ building: "mapBuilding",
448
+ boundary: "mapBoundary",
449
+ label: "mapLabel",
450
+ labelHalo: "mapLabelHalo",
451
+ accent: "accent",
452
+ text: "text",
453
+ surface: "surface",
454
+ focus: "focusRing",
455
+ categorical: chartRoles.categorical,
456
+ sequential: chartRoles.sequential
457
+ };
458
+ var syntaxRoles = {
459
+ background: "surfaceInverse",
460
+ text: "textInverse",
461
+ keyword: "syntaxKeyword",
462
+ string: "syntaxString",
463
+ comment: "syntaxComment",
464
+ constant: "syntaxConstant",
465
+ function: "syntaxFunction",
466
+ parameter: "syntaxParameter",
467
+ punctuation: "syntaxPunctuation"
266
468
  };
469
+ var syntaxColors = (scheme = "light") => resolveRoles(syntaxRoles, scheme);
470
+ var chartColors = (scheme = "light") => resolveRoles(chartRoles, scheme);
471
+ var mapColors = (scheme = "light") => resolveRoles(mapRoles, scheme);
267
472
  var darkDeclarations = () => Object.entries(darkSemantic).map(([name, value]) => ` ${cssVarName([name])}: ${value};`);
268
473
  function generateDarkCss(scope = "attribute") {
269
474
  const body = [" color-scheme: dark;", ...darkDeclarations()];
@@ -305,6 +510,8 @@ export {
305
510
  aspectRatio,
306
511
  borders,
307
512
  breakpoints,
513
+ chartColors,
514
+ chartRoles,
308
515
  colors,
309
516
  contrastRequirements,
310
517
  cssVarName,
@@ -316,12 +523,19 @@ export {
316
523
  getContrastRatio,
317
524
  getContrastTextColor,
318
525
  getLuminance,
526
+ mapColors,
527
+ mapRoles,
319
528
  meetsContrast,
320
529
  motion,
530
+ resolveRoles,
531
+ roleValue,
532
+ roleVar,
321
533
  semantic,
322
534
  shadows,
323
535
  sizing,
324
536
  spacing,
537
+ syntaxColors,
538
+ syntaxRoles,
325
539
  tokens,
326
540
  typography,
327
541
  validateContrast,
package/dist/tokens.css CHANGED
@@ -18,6 +18,38 @@
18
18
  --loidolt-color-success: #3f5139;
19
19
  --loidolt-color-warning: #7c4d17;
20
20
  --loidolt-color-info: #265162;
21
+ --loidolt-color-series-1: #c65224;
22
+ --loidolt-color-series-2: #2f6f8a;
23
+ --loidolt-color-series-3: #5b7a3a;
24
+ --loidolt-color-series-4: #9a6a12;
25
+ --loidolt-color-series-5: #7a4a78;
26
+ --loidolt-color-series-6: #4d5a6a;
27
+ --loidolt-color-series-7: #2f7d6d;
28
+ --loidolt-color-series-8: #8a5a3c;
29
+ --loidolt-color-sequential-1: #ecd3b8;
30
+ --loidolt-color-sequential-2: #dea67a;
31
+ --loidolt-color-sequential-3: #c97a45;
32
+ --loidolt-color-sequential-4: #a4521f;
33
+ --loidolt-color-sequential-5: #6e3314;
34
+ --loidolt-color-diverging-1: #265162;
35
+ --loidolt-color-diverging-2: #4f8196;
36
+ --loidolt-color-diverging-3: #9cbac3;
37
+ --loidolt-color-diverging-4: #ddd7c9;
38
+ --loidolt-color-diverging-5: #e0a986;
39
+ --loidolt-color-diverging-6: #c96f3d;
40
+ --loidolt-color-diverging-7: #9b3a17;
41
+ --loidolt-color-syntax-keyword: #f0895c;
42
+ --loidolt-color-syntax-string: #a3c197;
43
+ --loidolt-color-syntax-comment: #b5ae9c;
44
+ --loidolt-color-syntax-constant: #e2b56c;
45
+ --loidolt-color-syntax-function: #8fc0d4;
46
+ --loidolt-color-syntax-parameter: #d3a8cf;
47
+ --loidolt-color-syntax-punctuation: #d8d2c4;
48
+ --loidolt-color-map-water: #b9cdd3;
49
+ --loidolt-color-map-park: #d3d8bd;
50
+ --loidolt-color-map-road: #f5f2e9;
51
+ --loidolt-color-map-road-major: #ffffff;
52
+ --loidolt-color-map-building: #d8d3c7;
21
53
  --loidolt-font-display: "Jost", "Avenir Next", sans-serif;
22
54
  --loidolt-font-utility: "Archivo", "Helvetica Neue", sans-serif;
23
55
  --loidolt-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
@@ -111,4 +143,42 @@
111
143
  --loidolt-focus-ring: var(--loidolt-color-orange);
112
144
  --loidolt-shadow-color: var(--loidolt-color-deep);
113
145
  --loidolt-scrim: color-mix(in srgb, var(--loidolt-shadow-color) 72%, transparent);
146
+ --loidolt-chart-1: var(--loidolt-color-series-1);
147
+ --loidolt-chart-2: var(--loidolt-color-series-2);
148
+ --loidolt-chart-3: var(--loidolt-color-series-3);
149
+ --loidolt-chart-4: var(--loidolt-color-series-4);
150
+ --loidolt-chart-5: var(--loidolt-color-series-5);
151
+ --loidolt-chart-6: var(--loidolt-color-series-6);
152
+ --loidolt-chart-7: var(--loidolt-color-series-7);
153
+ --loidolt-chart-8: var(--loidolt-color-series-8);
154
+ --loidolt-chart-sequential-1: var(--loidolt-color-sequential-1);
155
+ --loidolt-chart-sequential-2: var(--loidolt-color-sequential-2);
156
+ --loidolt-chart-sequential-3: var(--loidolt-color-sequential-3);
157
+ --loidolt-chart-sequential-4: var(--loidolt-color-sequential-4);
158
+ --loidolt-chart-sequential-5: var(--loidolt-color-sequential-5);
159
+ --loidolt-chart-diverging-1: var(--loidolt-color-diverging-1);
160
+ --loidolt-chart-diverging-2: var(--loidolt-color-diverging-2);
161
+ --loidolt-chart-diverging-3: var(--loidolt-color-diverging-3);
162
+ --loidolt-chart-diverging-4: var(--loidolt-color-diverging-4);
163
+ --loidolt-chart-diverging-5: var(--loidolt-color-diverging-5);
164
+ --loidolt-chart-diverging-6: var(--loidolt-color-diverging-6);
165
+ --loidolt-chart-diverging-7: var(--loidolt-color-diverging-7);
166
+ --loidolt-chart-positive: var(--loidolt-color-success);
167
+ --loidolt-chart-negative: var(--loidolt-color-error);
168
+ --loidolt-map-land: var(--loidolt-color-paper);
169
+ --loidolt-map-water: var(--loidolt-color-map-water);
170
+ --loidolt-map-park: var(--loidolt-color-map-park);
171
+ --loidolt-map-road: var(--loidolt-color-map-road);
172
+ --loidolt-map-road-major: var(--loidolt-color-map-road-major);
173
+ --loidolt-map-building: var(--loidolt-color-map-building);
174
+ --loidolt-map-boundary: var(--loidolt-color-line-strong);
175
+ --loidolt-map-label: var(--loidolt-color-deep);
176
+ --loidolt-map-label-halo: var(--loidolt-color-panel);
177
+ --loidolt-syntax-keyword: var(--loidolt-color-syntax-keyword);
178
+ --loidolt-syntax-string: var(--loidolt-color-syntax-string);
179
+ --loidolt-syntax-comment: var(--loidolt-color-syntax-comment);
180
+ --loidolt-syntax-constant: var(--loidolt-color-syntax-constant);
181
+ --loidolt-syntax-function: var(--loidolt-color-syntax-function);
182
+ --loidolt-syntax-parameter: var(--loidolt-color-syntax-parameter);
183
+ --loidolt-syntax-punctuation: var(--loidolt-color-syntax-punctuation);
114
184
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loidolt/theme-tokens",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Typed design tokens for Loidolt applications",
5
5
  "license": "MIT",
6
6
  "type": "module",