@kanso-labs/kanso-ui-core 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -423
- package/dist/product-theme-CfDDgv7F.js +1012 -0
- package/dist/product-theme-CfDDgv7F.js.map +1 -0
- package/dist/product-theme-D117EbtF.d.ts +803 -0
- package/dist/themes.d.ts +14 -2
- package/dist/themes.js +1066 -959
- package/dist/themes.js.map +1 -1
- package/dist/tokens.css +445 -128
- package/dist/tokens.json +905 -591
- package/package.json +2 -2
- package/dist/defaults-UY9g7wIs.d.ts +0 -429
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,1012 @@
|
|
|
1
|
+
// src/contrast.ts
|
|
2
|
+
/** WCAG 2's bar for text and the glyphs that carry meaning. */
|
|
3
|
+
const TEXT = 4.5;
|
|
4
|
+
const kansoPairs = [
|
|
5
|
+
...[
|
|
6
|
+
"paper",
|
|
7
|
+
"kanso-surface",
|
|
8
|
+
"surface-sunken",
|
|
9
|
+
"container"
|
|
10
|
+
].flatMap((ground) => [[
|
|
11
|
+
"ink",
|
|
12
|
+
ground,
|
|
13
|
+
TEXT
|
|
14
|
+
], [
|
|
15
|
+
"ink-muted",
|
|
16
|
+
ground,
|
|
17
|
+
TEXT
|
|
18
|
+
]]),
|
|
19
|
+
[
|
|
20
|
+
"on-ink",
|
|
21
|
+
"ink",
|
|
22
|
+
TEXT
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
"accent",
|
|
26
|
+
"paper",
|
|
27
|
+
TEXT
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
"accent",
|
|
31
|
+
"kanso-surface",
|
|
32
|
+
TEXT
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
"on-accent",
|
|
36
|
+
"accent",
|
|
37
|
+
TEXT
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
"on-accent-soft",
|
|
41
|
+
"accent-soft",
|
|
42
|
+
TEXT
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
"accent-on-ink",
|
|
46
|
+
"ink",
|
|
47
|
+
TEXT
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
"on-spotlight",
|
|
51
|
+
"spotlight",
|
|
52
|
+
TEXT
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
"on-spotlight-muted",
|
|
56
|
+
"spotlight",
|
|
57
|
+
TEXT
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
"on-spotlight",
|
|
61
|
+
"spotlight-tonal over spotlight",
|
|
62
|
+
TEXT
|
|
63
|
+
],
|
|
64
|
+
[
|
|
65
|
+
"on-spotlight-button",
|
|
66
|
+
"spotlight-button",
|
|
67
|
+
TEXT
|
|
68
|
+
],
|
|
69
|
+
[
|
|
70
|
+
"spotlight-line",
|
|
71
|
+
"spotlight",
|
|
72
|
+
3
|
|
73
|
+
],
|
|
74
|
+
[
|
|
75
|
+
"positive",
|
|
76
|
+
"paper",
|
|
77
|
+
TEXT
|
|
78
|
+
],
|
|
79
|
+
[
|
|
80
|
+
"positive",
|
|
81
|
+
"kanso-surface",
|
|
82
|
+
TEXT
|
|
83
|
+
],
|
|
84
|
+
[
|
|
85
|
+
"on-positive-soft",
|
|
86
|
+
"positive-soft",
|
|
87
|
+
TEXT
|
|
88
|
+
],
|
|
89
|
+
[
|
|
90
|
+
"caution",
|
|
91
|
+
"paper",
|
|
92
|
+
TEXT
|
|
93
|
+
],
|
|
94
|
+
[
|
|
95
|
+
"caution",
|
|
96
|
+
"kanso-surface",
|
|
97
|
+
TEXT
|
|
98
|
+
],
|
|
99
|
+
[
|
|
100
|
+
"caution",
|
|
101
|
+
"caution-soft",
|
|
102
|
+
3
|
|
103
|
+
],
|
|
104
|
+
[
|
|
105
|
+
"on-caution-soft",
|
|
106
|
+
"caution-soft",
|
|
107
|
+
TEXT
|
|
108
|
+
],
|
|
109
|
+
[
|
|
110
|
+
"negative",
|
|
111
|
+
"paper",
|
|
112
|
+
TEXT
|
|
113
|
+
],
|
|
114
|
+
[
|
|
115
|
+
"negative",
|
|
116
|
+
"kanso-surface",
|
|
117
|
+
TEXT
|
|
118
|
+
],
|
|
119
|
+
[
|
|
120
|
+
"on-negative-soft",
|
|
121
|
+
"negative-soft",
|
|
122
|
+
TEXT
|
|
123
|
+
],
|
|
124
|
+
[
|
|
125
|
+
"critical",
|
|
126
|
+
"paper",
|
|
127
|
+
TEXT
|
|
128
|
+
],
|
|
129
|
+
[
|
|
130
|
+
"critical",
|
|
131
|
+
"kanso-surface",
|
|
132
|
+
TEXT
|
|
133
|
+
],
|
|
134
|
+
[
|
|
135
|
+
"on-critical",
|
|
136
|
+
"critical",
|
|
137
|
+
TEXT
|
|
138
|
+
],
|
|
139
|
+
[
|
|
140
|
+
"on-critical-soft",
|
|
141
|
+
"critical-soft",
|
|
142
|
+
TEXT
|
|
143
|
+
],
|
|
144
|
+
[
|
|
145
|
+
"outline",
|
|
146
|
+
"paper",
|
|
147
|
+
3
|
|
148
|
+
],
|
|
149
|
+
[
|
|
150
|
+
"outline",
|
|
151
|
+
"kanso-surface",
|
|
152
|
+
3
|
|
153
|
+
],
|
|
154
|
+
[
|
|
155
|
+
"focus-ring",
|
|
156
|
+
"paper",
|
|
157
|
+
3
|
|
158
|
+
]
|
|
159
|
+
];
|
|
160
|
+
const ROLE_GROUNDS = [
|
|
161
|
+
"surface",
|
|
162
|
+
"surface-container-lowest",
|
|
163
|
+
"surface-container-low",
|
|
164
|
+
"surface-container",
|
|
165
|
+
"surface-container-high",
|
|
166
|
+
"surface-container-highest",
|
|
167
|
+
"surface-variant"
|
|
168
|
+
];
|
|
169
|
+
const FILLS = [
|
|
170
|
+
"primary",
|
|
171
|
+
"primary-container",
|
|
172
|
+
"secondary",
|
|
173
|
+
"secondary-container",
|
|
174
|
+
"tertiary",
|
|
175
|
+
"tertiary-container",
|
|
176
|
+
"error",
|
|
177
|
+
"error-container",
|
|
178
|
+
"positive",
|
|
179
|
+
"positive-container",
|
|
180
|
+
"negative",
|
|
181
|
+
"negative-container"
|
|
182
|
+
];
|
|
183
|
+
const rolePairs = [
|
|
184
|
+
...ROLE_GROUNDS.flatMap((ground) => [
|
|
185
|
+
[
|
|
186
|
+
"on-surface",
|
|
187
|
+
ground,
|
|
188
|
+
TEXT
|
|
189
|
+
],
|
|
190
|
+
[
|
|
191
|
+
"on-surface-variant",
|
|
192
|
+
ground,
|
|
193
|
+
TEXT
|
|
194
|
+
],
|
|
195
|
+
[
|
|
196
|
+
"outline",
|
|
197
|
+
ground,
|
|
198
|
+
3
|
|
199
|
+
]
|
|
200
|
+
]),
|
|
201
|
+
...FILLS.map((fill) => [
|
|
202
|
+
`on-${fill}`,
|
|
203
|
+
fill,
|
|
204
|
+
TEXT
|
|
205
|
+
]),
|
|
206
|
+
[
|
|
207
|
+
"inverse-on-surface",
|
|
208
|
+
"inverse-surface",
|
|
209
|
+
TEXT
|
|
210
|
+
],
|
|
211
|
+
[
|
|
212
|
+
"inverse-primary",
|
|
213
|
+
"inverse-surface",
|
|
214
|
+
TEXT
|
|
215
|
+
],
|
|
216
|
+
[
|
|
217
|
+
"inverse-error",
|
|
218
|
+
"inverse-surface",
|
|
219
|
+
TEXT
|
|
220
|
+
],
|
|
221
|
+
[
|
|
222
|
+
"primary",
|
|
223
|
+
"surface",
|
|
224
|
+
TEXT
|
|
225
|
+
],
|
|
226
|
+
[
|
|
227
|
+
"primary",
|
|
228
|
+
"surface-container-low",
|
|
229
|
+
TEXT
|
|
230
|
+
],
|
|
231
|
+
[
|
|
232
|
+
"primary",
|
|
233
|
+
"surface-container-highest",
|
|
234
|
+
TEXT
|
|
235
|
+
],
|
|
236
|
+
[
|
|
237
|
+
"primary",
|
|
238
|
+
"primary-container",
|
|
239
|
+
TEXT
|
|
240
|
+
],
|
|
241
|
+
[
|
|
242
|
+
"secondary",
|
|
243
|
+
"secondary-container",
|
|
244
|
+
TEXT
|
|
245
|
+
],
|
|
246
|
+
[
|
|
247
|
+
"error",
|
|
248
|
+
"surface",
|
|
249
|
+
TEXT
|
|
250
|
+
],
|
|
251
|
+
[
|
|
252
|
+
"error",
|
|
253
|
+
"surface-container-highest",
|
|
254
|
+
TEXT
|
|
255
|
+
],
|
|
256
|
+
[
|
|
257
|
+
"positive",
|
|
258
|
+
"surface",
|
|
259
|
+
TEXT
|
|
260
|
+
],
|
|
261
|
+
[
|
|
262
|
+
"negative",
|
|
263
|
+
"surface",
|
|
264
|
+
TEXT
|
|
265
|
+
],
|
|
266
|
+
[
|
|
267
|
+
"secondary",
|
|
268
|
+
"surface",
|
|
269
|
+
3
|
|
270
|
+
]
|
|
271
|
+
];
|
|
272
|
+
/** WCAG 2's contrast ratio between two opaque colours, 1 to 21. */
|
|
273
|
+
function contrast(first, second) {
|
|
274
|
+
const [lighter = 0, darker = 0] = [luminance(first), luminance(second)].toSorted((a, b) => b - a);
|
|
275
|
+
return (lighter + .05) / (darker + .05);
|
|
276
|
+
}
|
|
277
|
+
/** Whether a value is a colour the contrast check can read. */
|
|
278
|
+
function isColor(value) {
|
|
279
|
+
if (typeof value !== "string") return false;
|
|
280
|
+
try {
|
|
281
|
+
parseColor(value);
|
|
282
|
+
return true;
|
|
283
|
+
} catch {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function luminance([red, green, blue]) {
|
|
288
|
+
const [r = 0, g = 0, b = 0] = [
|
|
289
|
+
red,
|
|
290
|
+
green,
|
|
291
|
+
blue
|
|
292
|
+
].map((channel) => {
|
|
293
|
+
const value = channel / 255;
|
|
294
|
+
return value <= .04045 ? value / 12.92 : ((value + .055) / 1.055) ** 2.4;
|
|
295
|
+
});
|
|
296
|
+
return .2126 * r + .7152 * g + .0722 * b;
|
|
297
|
+
}
|
|
298
|
+
/** A colour painted over an opaque ground, as the eye sees it. */
|
|
299
|
+
function over(color, ground) {
|
|
300
|
+
const [red, green, blue, alpha] = parseColor(color);
|
|
301
|
+
const mix = (top, bottom) => top * alpha + bottom * (1 - alpha);
|
|
302
|
+
return [
|
|
303
|
+
mix(red, ground[0]),
|
|
304
|
+
mix(green, ground[1]),
|
|
305
|
+
mix(blue, ground[2]),
|
|
306
|
+
1
|
|
307
|
+
];
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* A `#rrggbb` or `rgba(r, g, b, a)` colour, as the token file writes them, as
|
|
311
|
+
* its channels, 0 to 255, and its alpha. Throws for anything else.
|
|
312
|
+
*/
|
|
313
|
+
function parseColor(color) {
|
|
314
|
+
const hex = /^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/iu.exec(color);
|
|
315
|
+
if (hex) {
|
|
316
|
+
const [, red = "", green = "", blue = ""] = hex;
|
|
317
|
+
return [
|
|
318
|
+
Number.parseInt(red, 16),
|
|
319
|
+
Number.parseInt(green, 16),
|
|
320
|
+
Number.parseInt(blue, 16),
|
|
321
|
+
1
|
|
322
|
+
];
|
|
323
|
+
}
|
|
324
|
+
const rgba = /^rgba\((\d{1,3}), (\d{1,3}), (\d{1,3}), (0|1|0?\.\d+|1\.0+)\)$/u.exec(color);
|
|
325
|
+
if (rgba) {
|
|
326
|
+
const [, red = "", green = "", blue = "", alpha = ""] = rgba;
|
|
327
|
+
const channels = [
|
|
328
|
+
Number(red),
|
|
329
|
+
Number(green),
|
|
330
|
+
Number(blue)
|
|
331
|
+
];
|
|
332
|
+
if (channels.every((channel) => channel <= 255)) {
|
|
333
|
+
const [r = 0, g = 0, b = 0] = channels;
|
|
334
|
+
return [
|
|
335
|
+
r,
|
|
336
|
+
g,
|
|
337
|
+
b,
|
|
338
|
+
Number(alpha)
|
|
339
|
+
];
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
throw new TypeError(`not a #rrggbb or rgba() colour: ${color}`);
|
|
343
|
+
}
|
|
344
|
+
/** A pair's ratio in a scheme, its ground resolved first. */
|
|
345
|
+
function ratioOf(scheme, foreground, ground) {
|
|
346
|
+
const colorOf = (name) => {
|
|
347
|
+
const value = scheme[`--kui-color-${name}`];
|
|
348
|
+
if (value === void 0) throw new Error(`no colour ${name}`);
|
|
349
|
+
return value;
|
|
350
|
+
};
|
|
351
|
+
const [top = "", under = top] = ground.split(" over ");
|
|
352
|
+
const base = parseColor(colorOf(under));
|
|
353
|
+
const grounded = top === under ? base : over(colorOf(top), base);
|
|
354
|
+
return contrast(over(colorOf(foreground), grounded), grounded);
|
|
355
|
+
}
|
|
356
|
+
// src/tokens/defaults.ts
|
|
357
|
+
/** Every property at its value in the light scheme, as `tokens.css` declares it. */
|
|
358
|
+
const light = {
|
|
359
|
+
"--kui-color-accent": "#1a1a1a",
|
|
360
|
+
"--kui-color-accent-on-ink": "#fafafa",
|
|
361
|
+
"--kui-color-accent-soft": "#e9e9e9",
|
|
362
|
+
"--kui-color-background": "#fafafa",
|
|
363
|
+
"--kui-color-caution": "#b25b00",
|
|
364
|
+
"--kui-color-caution-soft": "#ffe7cc",
|
|
365
|
+
"--kui-color-caution-stripe": "#ffc27a",
|
|
366
|
+
"--kui-color-container": "#e9e9e9",
|
|
367
|
+
"--kui-color-critical": "#b3261e",
|
|
368
|
+
"--kui-color-critical-soft": "#fcdedc",
|
|
369
|
+
"--kui-color-divider": "#e3e3e3",
|
|
370
|
+
"--kui-color-error": "#b3261e",
|
|
371
|
+
"--kui-color-error-container": "#fcdedc",
|
|
372
|
+
"--kui-color-focus-ring": "#1a1a1a",
|
|
373
|
+
"--kui-color-ink": "#1a1a1a",
|
|
374
|
+
"--kui-color-ink-muted": "#5c5c5c",
|
|
375
|
+
"--kui-color-inverse-error": "#f2b8b5",
|
|
376
|
+
"--kui-color-inverse-on-surface": "#fafafa",
|
|
377
|
+
"--kui-color-inverse-primary": "#fafafa",
|
|
378
|
+
"--kui-color-inverse-surface": "#1a1a1a",
|
|
379
|
+
"--kui-color-kanso-surface": "#ffffff",
|
|
380
|
+
"--kui-color-negative": "#a63a1f",
|
|
381
|
+
"--kui-color-negative-container": "#fce3dc",
|
|
382
|
+
"--kui-color-negative-soft": "#fce3dc",
|
|
383
|
+
"--kui-color-on-accent": "#fafafa",
|
|
384
|
+
"--kui-color-on-accent-soft": "#1a1a1a",
|
|
385
|
+
"--kui-color-on-background": "#1a1a1a",
|
|
386
|
+
"--kui-color-on-caution-soft": "#5c2e00",
|
|
387
|
+
"--kui-color-on-critical": "#ffffff",
|
|
388
|
+
"--kui-color-on-critical-soft": "#5f0e0a",
|
|
389
|
+
"--kui-color-on-error": "#ffffff",
|
|
390
|
+
"--kui-color-on-error-container": "#5f0e0a",
|
|
391
|
+
"--kui-color-on-ink": "#fafafa",
|
|
392
|
+
"--kui-color-on-negative": "#fafafa",
|
|
393
|
+
"--kui-color-on-negative-container": "#5a1a0a",
|
|
394
|
+
"--kui-color-on-negative-soft": "#5a1a0a",
|
|
395
|
+
"--kui-color-on-positive": "#fafafa",
|
|
396
|
+
"--kui-color-on-positive-container": "#0b3a1b",
|
|
397
|
+
"--kui-color-on-positive-soft": "#0b3a1b",
|
|
398
|
+
"--kui-color-on-primary": "#fafafa",
|
|
399
|
+
"--kui-color-on-primary-container": "#1a1a1a",
|
|
400
|
+
"--kui-color-on-primary-fixed": "#1a1a1a",
|
|
401
|
+
"--kui-color-on-primary-fixed-variant": "#1a1a1a",
|
|
402
|
+
"--kui-color-on-secondary": "#fafafa",
|
|
403
|
+
"--kui-color-on-secondary-container": "#1a1a1a",
|
|
404
|
+
"--kui-color-on-secondary-fixed": "#1a1a1a",
|
|
405
|
+
"--kui-color-on-secondary-fixed-variant": "#1a1a1a",
|
|
406
|
+
"--kui-color-on-spotlight": "#ffffff",
|
|
407
|
+
"--kui-color-on-spotlight-button": "#1a1a1a",
|
|
408
|
+
"--kui-color-on-spotlight-muted": "rgba(255, 255, 255, 0.8)",
|
|
409
|
+
"--kui-color-on-surface": "#1a1a1a",
|
|
410
|
+
"--kui-color-on-surface-variant": "#5c5c5c",
|
|
411
|
+
"--kui-color-on-tertiary": "#1a1a1a",
|
|
412
|
+
"--kui-color-on-tertiary-container": "#1a1a1a",
|
|
413
|
+
"--kui-color-on-tertiary-fixed": "#1a1a1a",
|
|
414
|
+
"--kui-color-on-tertiary-fixed-variant": "#1a1a1a",
|
|
415
|
+
"--kui-color-outline": "#8a8a8a",
|
|
416
|
+
"--kui-color-outline-variant": "#e3e3e3",
|
|
417
|
+
"--kui-color-paper": "#fafafa",
|
|
418
|
+
"--kui-color-positive": "#1e6b35",
|
|
419
|
+
"--kui-color-positive-container": "#ddf2e2",
|
|
420
|
+
"--kui-color-positive-soft": "#ddf2e2",
|
|
421
|
+
"--kui-color-primary": "#1a1a1a",
|
|
422
|
+
"--kui-color-primary-container": "#e9e9e9",
|
|
423
|
+
"--kui-color-primary-fixed": "#e9e9e9",
|
|
424
|
+
"--kui-color-primary-fixed-dim": "#e9e9e9",
|
|
425
|
+
"--kui-color-scrim": "rgba(0, 0, 0, 0.4)",
|
|
426
|
+
"--kui-color-secondary": "#1a1a1a",
|
|
427
|
+
"--kui-color-secondary-container": "#e9e9e9",
|
|
428
|
+
"--kui-color-secondary-fixed": "#e9e9e9",
|
|
429
|
+
"--kui-color-secondary-fixed-dim": "#e9e9e9",
|
|
430
|
+
"--kui-color-shadow": "#000000",
|
|
431
|
+
"--kui-color-spotlight": "#1a1a1a",
|
|
432
|
+
"--kui-color-spotlight-button": "#fafafa",
|
|
433
|
+
"--kui-color-spotlight-line": "rgba(255, 255, 255, 0.6)",
|
|
434
|
+
"--kui-color-spotlight-tonal": "rgba(255, 255, 255, 0.16)",
|
|
435
|
+
"--kui-color-surface": "#fafafa",
|
|
436
|
+
"--kui-color-surface-bright": "#ffffff",
|
|
437
|
+
"--kui-color-surface-container": "#ffffff",
|
|
438
|
+
"--kui-color-surface-container-high": "#ffffff",
|
|
439
|
+
"--kui-color-surface-container-highest": "#f0f0f0",
|
|
440
|
+
"--kui-color-surface-container-low": "#ffffff",
|
|
441
|
+
"--kui-color-surface-container-lowest": "#ffffff",
|
|
442
|
+
"--kui-color-surface-dim": "#fafafa",
|
|
443
|
+
"--kui-color-surface-sunken": "#f0f0f0",
|
|
444
|
+
"--kui-color-surface-tint": "#1a1a1a",
|
|
445
|
+
"--kui-color-surface-variant": "#f0f0f0",
|
|
446
|
+
"--kui-color-tertiary": "#e9e9e9",
|
|
447
|
+
"--kui-color-tertiary-container": "#e9e9e9",
|
|
448
|
+
"--kui-color-tertiary-fixed": "#e9e9e9",
|
|
449
|
+
"--kui-color-tertiary-fixed-dim": "#e9e9e9",
|
|
450
|
+
"--kui-motion-duration-long1": "450ms",
|
|
451
|
+
"--kui-motion-duration-long2": "500ms",
|
|
452
|
+
"--kui-motion-duration-long3": "600ms",
|
|
453
|
+
"--kui-motion-duration-medium1": "250ms",
|
|
454
|
+
"--kui-motion-duration-medium2": "300ms",
|
|
455
|
+
"--kui-motion-duration-medium3": "350ms",
|
|
456
|
+
"--kui-motion-duration-short1": "100ms",
|
|
457
|
+
"--kui-motion-duration-short2": "150ms",
|
|
458
|
+
"--kui-motion-duration-short3": "200ms",
|
|
459
|
+
"--kui-motion-easing-emphasized": "cubic-bezier(0.2, 0, 0, 1)",
|
|
460
|
+
"--kui-motion-easing-emphasized-accelerate": "cubic-bezier(0.3, 0, 0.8, 0.15)",
|
|
461
|
+
"--kui-motion-easing-emphasized-decelerate": "cubic-bezier(0.05, 0.7, 0.1, 1)",
|
|
462
|
+
"--kui-motion-easing-spring-fast": "cubic-bezier(0.34, 1.56, 0.64, 1)",
|
|
463
|
+
"--kui-motion-easing-spring-slow": "cubic-bezier(0.16, 1, 0.3, 1)",
|
|
464
|
+
"--kui-motion-easing-standard": "cubic-bezier(0.2, 0, 0, 1)",
|
|
465
|
+
"--kui-radius-circle": "9999px",
|
|
466
|
+
"--kui-radius-kanso-2xl": "24px",
|
|
467
|
+
"--kui-radius-kanso-3xl": "28px",
|
|
468
|
+
"--kui-radius-kanso-lg": "16px",
|
|
469
|
+
"--kui-radius-kanso-md": "12px",
|
|
470
|
+
"--kui-radius-kanso-pill": "999px",
|
|
471
|
+
"--kui-radius-kanso-sm": "8px",
|
|
472
|
+
"--kui-radius-kanso-xl": "20px",
|
|
473
|
+
"--kui-radius-kanso-xs": "4px",
|
|
474
|
+
"--kui-radius-lg": "16px",
|
|
475
|
+
"--kui-radius-md": "12px",
|
|
476
|
+
"--kui-radius-none": "0px",
|
|
477
|
+
"--kui-radius-pill": "9999px",
|
|
478
|
+
"--kui-radius-sm": "8px",
|
|
479
|
+
"--kui-radius-xl": "28px",
|
|
480
|
+
"--kui-radius-xs": "4px",
|
|
481
|
+
"--kui-shadow-elevation1": "0px 1px 2px 0px rgba(0, 0, 0, 0.06), 0px 2px 8px 0px rgba(0, 0, 0, 0.04)",
|
|
482
|
+
"--kui-shadow-elevation2": "0px 2px 6px 0px rgba(0, 0, 0, 0.08), 0px 8px 20px 0px rgba(0, 0, 0, 0.1)",
|
|
483
|
+
"--kui-shadow-elevation3": "0px 8px 24px 0px rgba(0, 0, 0, 0.12), 0px 24px 56px 0px rgba(0, 0, 0, 0.14)",
|
|
484
|
+
"--kui-shadow-elevation4": "0px 8px 24px 0px rgba(0, 0, 0, 0.12), 0px 24px 56px 0px rgba(0, 0, 0, 0.14)",
|
|
485
|
+
"--kui-shadow-elevation5": "0px 8px 24px 0px rgba(0, 0, 0, 0.12), 0px 24px 56px 0px rgba(0, 0, 0, 0.14)",
|
|
486
|
+
"--kui-shadow-kanso-1": "0px 1px 2px 0px rgba(0, 0, 0, 0.06), 0px 2px 8px 0px rgba(0, 0, 0, 0.04)",
|
|
487
|
+
"--kui-shadow-kanso-2": "0px 2px 6px 0px rgba(0, 0, 0, 0.08), 0px 8px 20px 0px rgba(0, 0, 0, 0.1)",
|
|
488
|
+
"--kui-shadow-kanso-3": "0px 8px 24px 0px rgba(0, 0, 0, 0.12), 0px 24px 56px 0px rgba(0, 0, 0, 0.14)",
|
|
489
|
+
"--kui-sizing-control-lg": "56px",
|
|
490
|
+
"--kui-sizing-control-md": "48px",
|
|
491
|
+
"--kui-sizing-control-sm": "40px",
|
|
492
|
+
"--kui-sizing-control-xl": "96px",
|
|
493
|
+
"--kui-sizing-control-xs": "32px",
|
|
494
|
+
"--kui-sizing-control-xxl": "136px",
|
|
495
|
+
"--kui-sizing-icon-lg": "24px",
|
|
496
|
+
"--kui-sizing-icon-md": "20px",
|
|
497
|
+
"--kui-sizing-icon-sm": "18px",
|
|
498
|
+
"--kui-sizing-icon-xl": "40px",
|
|
499
|
+
"--kui-sizing-icon-xs": "16px",
|
|
500
|
+
"--kui-sizing-kanso-avatar-lg": "56px",
|
|
501
|
+
"--kui-sizing-kanso-avatar-md": "36px",
|
|
502
|
+
"--kui-sizing-kanso-avatar-sm": "28px",
|
|
503
|
+
"--kui-sizing-kanso-control-lg": "48px",
|
|
504
|
+
"--kui-sizing-kanso-control-md": "40px",
|
|
505
|
+
"--kui-sizing-kanso-control-sm": "32px",
|
|
506
|
+
"--kui-sizing-kanso-control-xl": "56px",
|
|
507
|
+
"--kui-sizing-kanso-icon-lg": "24px",
|
|
508
|
+
"--kui-sizing-kanso-icon-md": "20px",
|
|
509
|
+
"--kui-sizing-kanso-icon-sm": "16px",
|
|
510
|
+
"--kui-sizing-kanso-icon-xl": "40px",
|
|
511
|
+
"--kui-sizing-kanso-row": "60px",
|
|
512
|
+
"--kui-sizing-kanso-row-compact": "44px",
|
|
513
|
+
"--kui-sizing-row-lg": "88px",
|
|
514
|
+
"--kui-sizing-row-md": "72px",
|
|
515
|
+
"--kui-sizing-row-sm": "56px",
|
|
516
|
+
"--kui-sizing-row-xs": "48px",
|
|
517
|
+
"--kui-spacing-kanso-2xl": "24px",
|
|
518
|
+
"--kui-spacing-kanso-2xs": "2px",
|
|
519
|
+
"--kui-spacing-kanso-3xl": "32px",
|
|
520
|
+
"--kui-spacing-kanso-4xl": "40px",
|
|
521
|
+
"--kui-spacing-kanso-5xl": "56px",
|
|
522
|
+
"--kui-spacing-kanso-lg": "16px",
|
|
523
|
+
"--kui-spacing-kanso-md": "12px",
|
|
524
|
+
"--kui-spacing-kanso-sm": "8px",
|
|
525
|
+
"--kui-spacing-kanso-xl": "20px",
|
|
526
|
+
"--kui-spacing-kanso-xs": "4px",
|
|
527
|
+
"--kui-spacing-lg": "16px",
|
|
528
|
+
"--kui-spacing-lg-plus": "20px",
|
|
529
|
+
"--kui-spacing-md": "12px",
|
|
530
|
+
"--kui-spacing-sm": "8px",
|
|
531
|
+
"--kui-spacing-xl": "24px",
|
|
532
|
+
"--kui-spacing-xs": "4px",
|
|
533
|
+
"--kui-spacing-xs-plus": "6px",
|
|
534
|
+
"--kui-spacing-xxl": "32px",
|
|
535
|
+
"--kui-spacing-xxs": "2px",
|
|
536
|
+
"--kui-spacing-xxxl": "40px",
|
|
537
|
+
"--kui-state-layer-opacity-disabled-container": "0.12",
|
|
538
|
+
"--kui-state-layer-opacity-disabled-content": "0.38",
|
|
539
|
+
"--kui-state-layer-opacity-dragged": "0.16",
|
|
540
|
+
"--kui-state-layer-opacity-focus": "0.1",
|
|
541
|
+
"--kui-state-layer-opacity-hover": "0.08",
|
|
542
|
+
"--kui-state-layer-opacity-kanso-disabled-container": "0.12",
|
|
543
|
+
"--kui-state-layer-opacity-kanso-disabled-content": "0.38",
|
|
544
|
+
"--kui-state-layer-opacity-kanso-focus": "0.1",
|
|
545
|
+
"--kui-state-layer-opacity-kanso-hover": "0.08",
|
|
546
|
+
"--kui-state-layer-opacity-kanso-pressed": "0.12",
|
|
547
|
+
"--kui-state-layer-opacity-pressed": "0.1",
|
|
548
|
+
"--kui-typography-body-large-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
549
|
+
"--kui-typography-body-large-line-height": "24px",
|
|
550
|
+
"--kui-typography-body-large-size": "16px",
|
|
551
|
+
"--kui-typography-body-large-tracking": "0.5px",
|
|
552
|
+
"--kui-typography-body-large-weight": "var(--kui-typography-weight-regular, 400)",
|
|
553
|
+
"--kui-typography-body-medium-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
554
|
+
"--kui-typography-body-medium-line-height": "20px",
|
|
555
|
+
"--kui-typography-body-medium-size": "14px",
|
|
556
|
+
"--kui-typography-body-medium-tracking": "0.25px",
|
|
557
|
+
"--kui-typography-body-medium-weight": "var(--kui-typography-weight-regular, 400)",
|
|
558
|
+
"--kui-typography-body-small-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
559
|
+
"--kui-typography-body-small-line-height": "16px",
|
|
560
|
+
"--kui-typography-body-small-size": "12px",
|
|
561
|
+
"--kui-typography-body-small-tracking": "0.4px",
|
|
562
|
+
"--kui-typography-body-small-weight": "var(--kui-typography-weight-regular, 400)",
|
|
563
|
+
"--kui-typography-display-large-font": "var(--kui-typography-font-family-brand, 'Roboto Serif', 'Iowan Old Style', Georgia, serif)",
|
|
564
|
+
"--kui-typography-display-large-line-height": "64px",
|
|
565
|
+
"--kui-typography-display-large-size": "57px",
|
|
566
|
+
"--kui-typography-display-large-tracking": "-0.25px",
|
|
567
|
+
"--kui-typography-display-large-weight": "var(--kui-typography-weight-light, 300)",
|
|
568
|
+
"--kui-typography-display-medium-font": "var(--kui-typography-font-family-brand, 'Roboto Serif', 'Iowan Old Style', Georgia, serif)",
|
|
569
|
+
"--kui-typography-display-medium-line-height": "52px",
|
|
570
|
+
"--kui-typography-display-medium-size": "45px",
|
|
571
|
+
"--kui-typography-display-medium-tracking": "0px",
|
|
572
|
+
"--kui-typography-display-medium-weight": "var(--kui-typography-weight-light, 300)",
|
|
573
|
+
"--kui-typography-display-small-font": "var(--kui-typography-font-family-brand, 'Roboto Serif', 'Iowan Old Style', Georgia, serif)",
|
|
574
|
+
"--kui-typography-display-small-line-height": "44px",
|
|
575
|
+
"--kui-typography-display-small-size": "36px",
|
|
576
|
+
"--kui-typography-display-small-tracking": "0px",
|
|
577
|
+
"--kui-typography-display-small-weight": "var(--kui-typography-weight-light, 300)",
|
|
578
|
+
"--kui-typography-font-family-brand": "'Roboto Serif', 'Iowan Old Style', Georgia, serif",
|
|
579
|
+
"--kui-typography-font-family-mono": "'Roboto Mono', ui-monospace, 'SF Mono', Menlo, monospace",
|
|
580
|
+
"--kui-typography-font-family-plain": "'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
581
|
+
"--kui-typography-font-family-voice": "'Roboto Serif', 'Iowan Old Style', Georgia, serif",
|
|
582
|
+
"--kui-typography-headline-large-font": "var(--kui-typography-font-family-brand, 'Roboto Serif', 'Iowan Old Style', Georgia, serif)",
|
|
583
|
+
"--kui-typography-headline-large-line-height": "40px",
|
|
584
|
+
"--kui-typography-headline-large-size": "32px",
|
|
585
|
+
"--kui-typography-headline-large-tracking": "0px",
|
|
586
|
+
"--kui-typography-headline-large-weight": "var(--kui-typography-weight-light, 300)",
|
|
587
|
+
"--kui-typography-headline-medium-font": "var(--kui-typography-font-family-brand, 'Roboto Serif', 'Iowan Old Style', Georgia, serif)",
|
|
588
|
+
"--kui-typography-headline-medium-line-height": "36px",
|
|
589
|
+
"--kui-typography-headline-medium-size": "28px",
|
|
590
|
+
"--kui-typography-headline-medium-tracking": "0px",
|
|
591
|
+
"--kui-typography-headline-medium-weight": "var(--kui-typography-weight-light, 300)",
|
|
592
|
+
"--kui-typography-headline-small-font": "var(--kui-typography-font-family-brand, 'Roboto Serif', 'Iowan Old Style', Georgia, serif)",
|
|
593
|
+
"--kui-typography-headline-small-line-height": "32px",
|
|
594
|
+
"--kui-typography-headline-small-size": "24px",
|
|
595
|
+
"--kui-typography-headline-small-tracking": "0px",
|
|
596
|
+
"--kui-typography-headline-small-weight": "var(--kui-typography-weight-light, 300)",
|
|
597
|
+
"--kui-typography-label-large-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
598
|
+
"--kui-typography-label-large-line-height": "20px",
|
|
599
|
+
"--kui-typography-label-large-size": "14px",
|
|
600
|
+
"--kui-typography-label-large-tracking": "0.1px",
|
|
601
|
+
"--kui-typography-label-large-weight": "var(--kui-typography-weight-medium, 500)",
|
|
602
|
+
"--kui-typography-label-medium-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
603
|
+
"--kui-typography-label-medium-line-height": "16px",
|
|
604
|
+
"--kui-typography-label-medium-size": "12px",
|
|
605
|
+
"--kui-typography-label-medium-tracking": "0.5px",
|
|
606
|
+
"--kui-typography-label-medium-weight": "var(--kui-typography-weight-medium, 500)",
|
|
607
|
+
"--kui-typography-label-small-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
608
|
+
"--kui-typography-label-small-line-height": "16px",
|
|
609
|
+
"--kui-typography-label-small-size": "11px",
|
|
610
|
+
"--kui-typography-label-small-tracking": "0.5px",
|
|
611
|
+
"--kui-typography-label-small-weight": "var(--kui-typography-weight-medium, 500)",
|
|
612
|
+
"--kui-typography-t-body-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
613
|
+
"--kui-typography-t-body-large-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
614
|
+
"--kui-typography-t-body-large-line-height": "26px",
|
|
615
|
+
"--kui-typography-t-body-large-size": "17px",
|
|
616
|
+
"--kui-typography-t-body-large-tracking": "0px",
|
|
617
|
+
"--kui-typography-t-body-large-weight": "var(--kui-typography-weight-regular, 400)",
|
|
618
|
+
"--kui-typography-t-body-line-height": "20px",
|
|
619
|
+
"--kui-typography-t-body-size": "15px",
|
|
620
|
+
"--kui-typography-t-body-small-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
621
|
+
"--kui-typography-t-body-small-line-height": "20px",
|
|
622
|
+
"--kui-typography-t-body-small-size": "14px",
|
|
623
|
+
"--kui-typography-t-body-small-tracking": "0px",
|
|
624
|
+
"--kui-typography-t-body-small-weight": "var(--kui-typography-weight-regular, 400)",
|
|
625
|
+
"--kui-typography-t-body-strong-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
626
|
+
"--kui-typography-t-body-strong-line-height": "22px",
|
|
627
|
+
"--kui-typography-t-body-strong-size": "16px",
|
|
628
|
+
"--kui-typography-t-body-strong-tracking": "0px",
|
|
629
|
+
"--kui-typography-t-body-strong-weight": "var(--kui-typography-weight-medium, 500)",
|
|
630
|
+
"--kui-typography-t-body-tracking": "0px",
|
|
631
|
+
"--kui-typography-t-body-weight": "var(--kui-typography-weight-regular, 400)",
|
|
632
|
+
"--kui-typography-t-caption-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
633
|
+
"--kui-typography-t-caption-line-height": "16px",
|
|
634
|
+
"--kui-typography-t-caption-size": "12px",
|
|
635
|
+
"--kui-typography-t-caption-tracking": "0px",
|
|
636
|
+
"--kui-typography-t-caption-weight": "var(--kui-typography-weight-medium, 500)",
|
|
637
|
+
"--kui-typography-t-display-font": "var(--kui-typography-font-family-voice, 'Roboto Serif', 'Iowan Old Style', Georgia, serif)",
|
|
638
|
+
"--kui-typography-t-display-line-height": "52px",
|
|
639
|
+
"--kui-typography-t-display-size": "44px",
|
|
640
|
+
"--kui-typography-t-display-tracking": "-0.66px",
|
|
641
|
+
"--kui-typography-t-display-weight": "var(--kui-typography-weight-light, 300)",
|
|
642
|
+
"--kui-typography-t-figure-font": "var(--kui-typography-font-family-mono, 'Roboto Mono', ui-monospace, 'SF Mono', Menlo, monospace)",
|
|
643
|
+
"--kui-typography-t-figure-large-font": "var(--kui-typography-font-family-mono, 'Roboto Mono', ui-monospace, 'SF Mono', Menlo, monospace)",
|
|
644
|
+
"--kui-typography-t-figure-large-line-height": "30px",
|
|
645
|
+
"--kui-typography-t-figure-large-size": "24px",
|
|
646
|
+
"--kui-typography-t-figure-large-tracking": "0px",
|
|
647
|
+
"--kui-typography-t-figure-large-weight": "var(--kui-typography-weight-medium, 500)",
|
|
648
|
+
"--kui-typography-t-figure-line-height": "20px",
|
|
649
|
+
"--kui-typography-t-figure-size": "15px",
|
|
650
|
+
"--kui-typography-t-figure-small-font": "var(--kui-typography-font-family-mono, 'Roboto Mono', ui-monospace, 'SF Mono', Menlo, monospace)",
|
|
651
|
+
"--kui-typography-t-figure-small-line-height": "18px",
|
|
652
|
+
"--kui-typography-t-figure-small-size": "13px",
|
|
653
|
+
"--kui-typography-t-figure-small-tracking": "0px",
|
|
654
|
+
"--kui-typography-t-figure-small-weight": "var(--kui-typography-weight-medium, 500)",
|
|
655
|
+
"--kui-typography-t-figure-tracking": "0px",
|
|
656
|
+
"--kui-typography-t-figure-weight": "var(--kui-typography-weight-medium, 500)",
|
|
657
|
+
"--kui-typography-t-headline-font": "var(--kui-typography-font-family-voice, 'Roboto Serif', 'Iowan Old Style', Georgia, serif)",
|
|
658
|
+
"--kui-typography-t-headline-line-height": "40px",
|
|
659
|
+
"--kui-typography-t-headline-size": "34px",
|
|
660
|
+
"--kui-typography-t-headline-tracking": "-0.34px",
|
|
661
|
+
"--kui-typography-t-headline-weight": "var(--kui-typography-weight-light, 300)",
|
|
662
|
+
"--kui-typography-t-hero-font": "var(--kui-typography-font-family-voice, 'Roboto Serif', 'Iowan Old Style', Georgia, serif)",
|
|
663
|
+
"--kui-typography-t-hero-line-height": "58px",
|
|
664
|
+
"--kui-typography-t-hero-size": "52px",
|
|
665
|
+
"--kui-typography-t-hero-tracking": "-0.78px",
|
|
666
|
+
"--kui-typography-t-hero-weight": "var(--kui-typography-weight-light, 300)",
|
|
667
|
+
"--kui-typography-t-label-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
668
|
+
"--kui-typography-t-label-line-height": "18px",
|
|
669
|
+
"--kui-typography-t-label-size": "13px",
|
|
670
|
+
"--kui-typography-t-label-strong-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
671
|
+
"--kui-typography-t-label-strong-line-height": "20px",
|
|
672
|
+
"--kui-typography-t-label-strong-size": "15px",
|
|
673
|
+
"--kui-typography-t-label-strong-tracking": "0px",
|
|
674
|
+
"--kui-typography-t-label-strong-weight": "var(--kui-typography-weight-semibold, 600)",
|
|
675
|
+
"--kui-typography-t-label-tracking": "0px",
|
|
676
|
+
"--kui-typography-t-label-weight": "var(--kui-typography-weight-medium, 500)",
|
|
677
|
+
"--kui-typography-t-section-font": "var(--kui-typography-font-family-voice, 'Roboto Serif', 'Iowan Old Style', Georgia, serif)",
|
|
678
|
+
"--kui-typography-t-section-line-height": "28px",
|
|
679
|
+
"--kui-typography-t-section-size": "22px",
|
|
680
|
+
"--kui-typography-t-section-tracking": "0px",
|
|
681
|
+
"--kui-typography-t-section-weight": "var(--kui-typography-weight-light, 300)",
|
|
682
|
+
"--kui-typography-t-title-font": "var(--kui-typography-font-family-voice, 'Roboto Serif', 'Iowan Old Style', Georgia, serif)",
|
|
683
|
+
"--kui-typography-t-title-line-height": "38px",
|
|
684
|
+
"--kui-typography-t-title-size": "32px",
|
|
685
|
+
"--kui-typography-t-title-tracking": "0px",
|
|
686
|
+
"--kui-typography-t-title-weight": "var(--kui-typography-weight-light, 300)",
|
|
687
|
+
"--kui-typography-title-large-font": "var(--kui-typography-font-family-brand, 'Roboto Serif', 'Iowan Old Style', Georgia, serif)",
|
|
688
|
+
"--kui-typography-title-large-line-height": "28px",
|
|
689
|
+
"--kui-typography-title-large-size": "22px",
|
|
690
|
+
"--kui-typography-title-large-tracking": "0px",
|
|
691
|
+
"--kui-typography-title-large-weight": "var(--kui-typography-weight-light, 300)",
|
|
692
|
+
"--kui-typography-title-medium-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
693
|
+
"--kui-typography-title-medium-line-height": "24px",
|
|
694
|
+
"--kui-typography-title-medium-size": "16px",
|
|
695
|
+
"--kui-typography-title-medium-tracking": "0.15px",
|
|
696
|
+
"--kui-typography-title-medium-weight": "var(--kui-typography-weight-medium, 500)",
|
|
697
|
+
"--kui-typography-title-small-font": "var(--kui-typography-font-family-plain, 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",
|
|
698
|
+
"--kui-typography-title-small-line-height": "20px",
|
|
699
|
+
"--kui-typography-title-small-size": "14px",
|
|
700
|
+
"--kui-typography-title-small-tracking": "0.1px",
|
|
701
|
+
"--kui-typography-title-small-weight": "var(--kui-typography-weight-medium, 500)",
|
|
702
|
+
"--kui-typography-weight-bold": "700",
|
|
703
|
+
"--kui-typography-weight-light": "300",
|
|
704
|
+
"--kui-typography-weight-medium": "500",
|
|
705
|
+
"--kui-typography-weight-regular": "400",
|
|
706
|
+
"--kui-typography-weight-semibold": "600"
|
|
707
|
+
};
|
|
708
|
+
/**
|
|
709
|
+
* Every property at its value in the dark scheme: the colours and shadows
|
|
710
|
+
* `tokens.css` declares under `prefers-color-scheme: dark`, over every other
|
|
711
|
+
* property at the one value it has in both.
|
|
712
|
+
*/
|
|
713
|
+
const dark = {
|
|
714
|
+
...light,
|
|
715
|
+
"--kui-color-accent": "#ececec",
|
|
716
|
+
"--kui-color-accent-on-ink": "#121212",
|
|
717
|
+
"--kui-color-accent-soft": "#2b2b2b",
|
|
718
|
+
"--kui-color-background": "#121212",
|
|
719
|
+
"--kui-color-caution": "#ffb870",
|
|
720
|
+
"--kui-color-caution-soft": "#4a2a00",
|
|
721
|
+
"--kui-color-caution-stripe": "#7a4600",
|
|
722
|
+
"--kui-color-container": "#2b2b2b",
|
|
723
|
+
"--kui-color-critical": "#f2b8b5",
|
|
724
|
+
"--kui-color-critical-soft": "#4d1512",
|
|
725
|
+
"--kui-color-divider": "#333333",
|
|
726
|
+
"--kui-color-error": "#f2b8b5",
|
|
727
|
+
"--kui-color-error-container": "#4d1512",
|
|
728
|
+
"--kui-color-focus-ring": "#ececec",
|
|
729
|
+
"--kui-color-ink": "#ececec",
|
|
730
|
+
"--kui-color-ink-muted": "#b3b3b3",
|
|
731
|
+
"--kui-color-inverse-error": "#b3261e",
|
|
732
|
+
"--kui-color-inverse-on-surface": "#121212",
|
|
733
|
+
"--kui-color-inverse-primary": "#121212",
|
|
734
|
+
"--kui-color-inverse-surface": "#ececec",
|
|
735
|
+
"--kui-color-kanso-surface": "#1c1c1c",
|
|
736
|
+
"--kui-color-negative": "#ffb4a1",
|
|
737
|
+
"--kui-color-negative-container": "#4a1a10",
|
|
738
|
+
"--kui-color-negative-soft": "#4a1a10",
|
|
739
|
+
"--kui-color-on-accent": "#121212",
|
|
740
|
+
"--kui-color-on-accent-soft": "#ececec",
|
|
741
|
+
"--kui-color-on-background": "#ececec",
|
|
742
|
+
"--kui-color-on-caution-soft": "#ffddb3",
|
|
743
|
+
"--kui-color-on-critical": "#601410",
|
|
744
|
+
"--kui-color-on-critical-soft": "#ffdad6",
|
|
745
|
+
"--kui-color-on-error": "#601410",
|
|
746
|
+
"--kui-color-on-error-container": "#ffdad6",
|
|
747
|
+
"--kui-color-on-ink": "#121212",
|
|
748
|
+
"--kui-color-on-negative": "#121212",
|
|
749
|
+
"--kui-color-on-negative-container": "#ffdad0",
|
|
750
|
+
"--kui-color-on-negative-soft": "#ffdad0",
|
|
751
|
+
"--kui-color-on-positive": "#121212",
|
|
752
|
+
"--kui-color-on-positive-container": "#c6f2d2",
|
|
753
|
+
"--kui-color-on-positive-soft": "#c6f2d2",
|
|
754
|
+
"--kui-color-on-primary": "#121212",
|
|
755
|
+
"--kui-color-on-primary-container": "#ececec",
|
|
756
|
+
"--kui-color-on-primary-fixed": "#ececec",
|
|
757
|
+
"--kui-color-on-primary-fixed-variant": "#ececec",
|
|
758
|
+
"--kui-color-on-secondary": "#121212",
|
|
759
|
+
"--kui-color-on-secondary-container": "#ececec",
|
|
760
|
+
"--kui-color-on-secondary-fixed": "#ececec",
|
|
761
|
+
"--kui-color-on-secondary-fixed-variant": "#ececec",
|
|
762
|
+
"--kui-color-on-surface": "#ececec",
|
|
763
|
+
"--kui-color-on-surface-variant": "#b3b3b3",
|
|
764
|
+
"--kui-color-on-tertiary": "#ececec",
|
|
765
|
+
"--kui-color-on-tertiary-container": "#ececec",
|
|
766
|
+
"--kui-color-on-tertiary-fixed": "#ececec",
|
|
767
|
+
"--kui-color-on-tertiary-fixed-variant": "#ececec",
|
|
768
|
+
"--kui-color-outline": "#8c8c8c",
|
|
769
|
+
"--kui-color-outline-variant": "#333333",
|
|
770
|
+
"--kui-color-paper": "#121212",
|
|
771
|
+
"--kui-color-positive": "#7bd99a",
|
|
772
|
+
"--kui-color-positive-container": "#123a20",
|
|
773
|
+
"--kui-color-positive-soft": "#123a20",
|
|
774
|
+
"--kui-color-primary": "#ececec",
|
|
775
|
+
"--kui-color-primary-container": "#2b2b2b",
|
|
776
|
+
"--kui-color-primary-fixed": "#2b2b2b",
|
|
777
|
+
"--kui-color-primary-fixed-dim": "#2b2b2b",
|
|
778
|
+
"--kui-color-scrim": "rgba(0, 0, 0, 0.6)",
|
|
779
|
+
"--kui-color-secondary": "#ececec",
|
|
780
|
+
"--kui-color-secondary-container": "#2b2b2b",
|
|
781
|
+
"--kui-color-secondary-fixed": "#2b2b2b",
|
|
782
|
+
"--kui-color-secondary-fixed-dim": "#2b2b2b",
|
|
783
|
+
"--kui-color-spotlight": "#2b2b2b",
|
|
784
|
+
"--kui-color-spotlight-button": "#ffffff",
|
|
785
|
+
"--kui-color-spotlight-tonal": "rgba(255, 255, 255, 0.14)",
|
|
786
|
+
"--kui-color-surface": "#121212",
|
|
787
|
+
"--kui-color-surface-bright": "#1c1c1c",
|
|
788
|
+
"--kui-color-surface-container": "#1c1c1c",
|
|
789
|
+
"--kui-color-surface-container-high": "#1c1c1c",
|
|
790
|
+
"--kui-color-surface-container-highest": "#262626",
|
|
791
|
+
"--kui-color-surface-container-low": "#1c1c1c",
|
|
792
|
+
"--kui-color-surface-container-lowest": "#1c1c1c",
|
|
793
|
+
"--kui-color-surface-dim": "#121212",
|
|
794
|
+
"--kui-color-surface-sunken": "#262626",
|
|
795
|
+
"--kui-color-surface-tint": "#ececec",
|
|
796
|
+
"--kui-color-surface-variant": "#262626",
|
|
797
|
+
"--kui-color-tertiary": "#2b2b2b",
|
|
798
|
+
"--kui-color-tertiary-container": "#2b2b2b",
|
|
799
|
+
"--kui-color-tertiary-fixed": "#2b2b2b",
|
|
800
|
+
"--kui-color-tertiary-fixed-dim": "#2b2b2b",
|
|
801
|
+
"--kui-shadow-elevation1": "0px 1px 2px 0px rgba(0, 0, 0, 0.5)",
|
|
802
|
+
"--kui-shadow-elevation2": "0px 4px 16px 0px rgba(0, 0, 0, 0.6)",
|
|
803
|
+
"--kui-shadow-elevation3": "0px 12px 40px 0px rgba(0, 0, 0, 0.7)",
|
|
804
|
+
"--kui-shadow-elevation4": "0px 12px 40px 0px rgba(0, 0, 0, 0.7)",
|
|
805
|
+
"--kui-shadow-elevation5": "0px 12px 40px 0px rgba(0, 0, 0, 0.7)",
|
|
806
|
+
"--kui-shadow-kanso-1": "0px 1px 2px 0px rgba(0, 0, 0, 0.5)",
|
|
807
|
+
"--kui-shadow-kanso-2": "0px 4px 16px 0px rgba(0, 0, 0, 0.6)",
|
|
808
|
+
"--kui-shadow-kanso-3": "0px 12px 40px 0px rgba(0, 0, 0, 0.7)"
|
|
809
|
+
};
|
|
810
|
+
/**
|
|
811
|
+
* The lower bound of each window size class, in px on the web and dp on
|
|
812
|
+
* native, smallest first. A media query cannot read a custom property, so
|
|
813
|
+
* neither library offers these as one to override, and `tokens.css` leaves
|
|
814
|
+
* them out.
|
|
815
|
+
*/
|
|
816
|
+
const breakpoints = {
|
|
817
|
+
compact: 0,
|
|
818
|
+
medium: 600,
|
|
819
|
+
expanded: 840,
|
|
820
|
+
large: 1200,
|
|
821
|
+
extraLarge: 1600
|
|
822
|
+
};
|
|
823
|
+
/**
|
|
824
|
+
* The roles a product brings its own colour for, in light and in dark: the
|
|
825
|
+
* accent and the spotlight, each with what is drawn on it. The base fills them
|
|
826
|
+
* from the neutrals, since Kanso's brand is ink and paper.
|
|
827
|
+
*/
|
|
828
|
+
const productRoles = [
|
|
829
|
+
"accent",
|
|
830
|
+
"onAccent",
|
|
831
|
+
"accentSoft",
|
|
832
|
+
"onAccentSoft",
|
|
833
|
+
"accentOnInk",
|
|
834
|
+
"spotlight",
|
|
835
|
+
"onSpotlight",
|
|
836
|
+
"onSpotlightMuted",
|
|
837
|
+
"spotlightButton",
|
|
838
|
+
"onSpotlightButton",
|
|
839
|
+
"spotlightTonal",
|
|
840
|
+
"spotlightLine"
|
|
841
|
+
];
|
|
842
|
+
/**
|
|
843
|
+
* Every colour that follows a product role, in each scheme, and the role it
|
|
844
|
+
* follows, in the scheme it reads it from: `primary` and `focus-ring`
|
|
845
|
+
* follow the accent, `on-primary` the on-accent, and so on. A product role
|
|
846
|
+
* follows itself.
|
|
847
|
+
*/
|
|
848
|
+
const productFollowers = {
|
|
849
|
+
dark: {
|
|
850
|
+
"--kui-color-accent": ["dark", "accent"],
|
|
851
|
+
"--kui-color-accent-on-ink": ["dark", "accentOnInk"],
|
|
852
|
+
"--kui-color-accent-soft": ["dark", "accentSoft"],
|
|
853
|
+
"--kui-color-focus-ring": ["dark", "accent"],
|
|
854
|
+
"--kui-color-inverse-primary": ["dark", "accentOnInk"],
|
|
855
|
+
"--kui-color-on-accent": ["dark", "onAccent"],
|
|
856
|
+
"--kui-color-on-accent-soft": ["dark", "onAccentSoft"],
|
|
857
|
+
"--kui-color-on-primary": ["dark", "onAccent"],
|
|
858
|
+
"--kui-color-on-primary-container": ["dark", "onAccentSoft"],
|
|
859
|
+
"--kui-color-on-primary-fixed": ["dark", "onAccentSoft"],
|
|
860
|
+
"--kui-color-on-primary-fixed-variant": ["dark", "onAccentSoft"],
|
|
861
|
+
"--kui-color-on-secondary-fixed": ["dark", "onAccentSoft"],
|
|
862
|
+
"--kui-color-on-secondary-fixed-variant": ["dark", "onAccentSoft"],
|
|
863
|
+
"--kui-color-on-spotlight": ["dark", "onSpotlight"],
|
|
864
|
+
"--kui-color-on-spotlight-button": ["dark", "onSpotlightButton"],
|
|
865
|
+
"--kui-color-on-spotlight-muted": ["dark", "onSpotlightMuted"],
|
|
866
|
+
"--kui-color-on-tertiary": ["dark", "onAccentSoft"],
|
|
867
|
+
"--kui-color-on-tertiary-container": ["dark", "onAccentSoft"],
|
|
868
|
+
"--kui-color-on-tertiary-fixed": ["dark", "onAccentSoft"],
|
|
869
|
+
"--kui-color-on-tertiary-fixed-variant": ["dark", "onAccentSoft"],
|
|
870
|
+
"--kui-color-primary": ["dark", "accent"],
|
|
871
|
+
"--kui-color-primary-container": ["dark", "accentSoft"],
|
|
872
|
+
"--kui-color-primary-fixed": ["dark", "accentSoft"],
|
|
873
|
+
"--kui-color-primary-fixed-dim": ["dark", "accentSoft"],
|
|
874
|
+
"--kui-color-secondary-fixed": ["dark", "accentSoft"],
|
|
875
|
+
"--kui-color-secondary-fixed-dim": ["dark", "accentSoft"],
|
|
876
|
+
"--kui-color-spotlight": ["dark", "spotlight"],
|
|
877
|
+
"--kui-color-spotlight-button": ["dark", "spotlightButton"],
|
|
878
|
+
"--kui-color-spotlight-line": ["dark", "spotlightLine"],
|
|
879
|
+
"--kui-color-spotlight-tonal": ["dark", "spotlightTonal"],
|
|
880
|
+
"--kui-color-surface-tint": ["dark", "accent"],
|
|
881
|
+
"--kui-color-tertiary": ["dark", "accentSoft"],
|
|
882
|
+
"--kui-color-tertiary-container": ["dark", "accentSoft"],
|
|
883
|
+
"--kui-color-tertiary-fixed": ["dark", "accentSoft"],
|
|
884
|
+
"--kui-color-tertiary-fixed-dim": ["dark", "accentSoft"]
|
|
885
|
+
},
|
|
886
|
+
light: {
|
|
887
|
+
"--kui-color-accent": ["light", "accent"],
|
|
888
|
+
"--kui-color-accent-on-ink": ["light", "accentOnInk"],
|
|
889
|
+
"--kui-color-accent-soft": ["light", "accentSoft"],
|
|
890
|
+
"--kui-color-focus-ring": ["light", "accent"],
|
|
891
|
+
"--kui-color-inverse-primary": ["light", "accentOnInk"],
|
|
892
|
+
"--kui-color-on-accent": ["light", "onAccent"],
|
|
893
|
+
"--kui-color-on-accent-soft": ["light", "onAccentSoft"],
|
|
894
|
+
"--kui-color-on-primary": ["light", "onAccent"],
|
|
895
|
+
"--kui-color-on-primary-container": ["light", "onAccentSoft"],
|
|
896
|
+
"--kui-color-on-primary-fixed": ["light", "onAccentSoft"],
|
|
897
|
+
"--kui-color-on-primary-fixed-variant": ["light", "onAccentSoft"],
|
|
898
|
+
"--kui-color-on-secondary-fixed": ["light", "onAccentSoft"],
|
|
899
|
+
"--kui-color-on-secondary-fixed-variant": ["light", "onAccentSoft"],
|
|
900
|
+
"--kui-color-on-spotlight": ["light", "onSpotlight"],
|
|
901
|
+
"--kui-color-on-spotlight-button": ["light", "onSpotlightButton"],
|
|
902
|
+
"--kui-color-on-spotlight-muted": ["light", "onSpotlightMuted"],
|
|
903
|
+
"--kui-color-on-tertiary": ["light", "onAccentSoft"],
|
|
904
|
+
"--kui-color-on-tertiary-container": ["light", "onAccentSoft"],
|
|
905
|
+
"--kui-color-on-tertiary-fixed": ["light", "onAccentSoft"],
|
|
906
|
+
"--kui-color-on-tertiary-fixed-variant": ["light", "onAccentSoft"],
|
|
907
|
+
"--kui-color-primary": ["light", "accent"],
|
|
908
|
+
"--kui-color-primary-container": ["light", "accentSoft"],
|
|
909
|
+
"--kui-color-primary-fixed": ["light", "accentSoft"],
|
|
910
|
+
"--kui-color-primary-fixed-dim": ["light", "accentSoft"],
|
|
911
|
+
"--kui-color-secondary-fixed": ["light", "accentSoft"],
|
|
912
|
+
"--kui-color-secondary-fixed-dim": ["light", "accentSoft"],
|
|
913
|
+
"--kui-color-spotlight": ["light", "spotlight"],
|
|
914
|
+
"--kui-color-spotlight-button": ["light", "spotlightButton"],
|
|
915
|
+
"--kui-color-spotlight-line": ["light", "spotlightLine"],
|
|
916
|
+
"--kui-color-spotlight-tonal": ["light", "spotlightTonal"],
|
|
917
|
+
"--kui-color-surface-tint": ["light", "accent"],
|
|
918
|
+
"--kui-color-tertiary": ["light", "accentSoft"],
|
|
919
|
+
"--kui-color-tertiary-container": ["light", "accentSoft"],
|
|
920
|
+
"--kui-color-tertiary-fixed": ["light", "accentSoft"],
|
|
921
|
+
"--kui-color-tertiary-fixed-dim": ["light", "accentSoft"]
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
// src/product-theme.ts
|
|
925
|
+
/** Thrown by {@link defineProductTheme} for a palette below a contrast target. */
|
|
926
|
+
var ProductThemeError = class extends Error {
|
|
927
|
+
/** Every pair below its target, in light and then in dark. */
|
|
928
|
+
failures;
|
|
929
|
+
constructor(failures) {
|
|
930
|
+
super(["The product colours miss these contrast targets:", ...failures.map(({ foreground, ground, ratio, scheme, target }) => ` ${scheme}: ${foreground} on ${ground} at ${ratio.toFixed(2)}:1, below ${target}:1`)].join("\n"));
|
|
931
|
+
this.name = "ProductThemeError";
|
|
932
|
+
this.failures = failures;
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
const DEFAULTS = {
|
|
936
|
+
dark,
|
|
937
|
+
light
|
|
938
|
+
};
|
|
939
|
+
/** A theme read by any property name, as the contrast pairs name them. */
|
|
940
|
+
function read(map) {
|
|
941
|
+
return map;
|
|
942
|
+
}
|
|
943
|
+
const SCHEMES = ["light", "dark"];
|
|
944
|
+
/**
|
|
945
|
+
* Builds a product's theme from its colours: every colour that follows a
|
|
946
|
+
* product role takes the product's value of it, `primary`, `focus-ring` and
|
|
947
|
+
* the other Material Design roles that alias the accent included, and
|
|
948
|
+
* everything else keeps its default.
|
|
949
|
+
*
|
|
950
|
+
* The colours are held to Kanso's contrast targets, WCAG 2's 4.5:1 for text
|
|
951
|
+
* and 3:1 for the rest, in both schemes, over the same pairs the base clears:
|
|
952
|
+
* those Kanso's usage notes name and those both libraries draw. A palette
|
|
953
|
+
* below one throws a {@link ProductThemeError} naming every pair; one missing
|
|
954
|
+
* a scheme or a role, naming one it does not have, or holding a value that is not a
|
|
955
|
+
* `#rrggbb` or `rgba()` colour throws a `TypeError`.
|
|
956
|
+
*
|
|
957
|
+
* Build it once, as a constant: both libraries' `ThemeScope` is to keep what
|
|
958
|
+
* it resolves for each theme object it is handed.
|
|
959
|
+
*
|
|
960
|
+
* ```ts
|
|
961
|
+
* const productTheme = defineProductTheme({ dark: { accent: '#cdb0f5', … }, light: { accent: '#6b3fa0', … } })
|
|
962
|
+
*
|
|
963
|
+
* <ThemeScope productTheme={productTheme}>…</ThemeScope>
|
|
964
|
+
* ```
|
|
965
|
+
*/
|
|
966
|
+
function defineProductTheme(palette) {
|
|
967
|
+
for (const scheme of SCHEMES) {
|
|
968
|
+
const given = palette[scheme];
|
|
969
|
+
if (typeof given !== "object" || given === null) throw new TypeError(`the palette has no ${scheme} colours`);
|
|
970
|
+
const colors = new Map(Object.entries(given));
|
|
971
|
+
const roles = productRoles;
|
|
972
|
+
const unknown = [...colors.keys()].filter((role) => !roles.includes(role));
|
|
973
|
+
if (unknown.length > 0) throw new TypeError(`${scheme} has no product role ${unknown.join(", ")}; the roles are ${roles.join(", ")}`);
|
|
974
|
+
for (const role of productRoles) if (!isColor(colors.get(role))) throw new TypeError(`${scheme}.${role} takes a #rrggbb or rgba() colour, not ${String(colors.get(role))}`);
|
|
975
|
+
}
|
|
976
|
+
const followed = (scheme) => ({
|
|
977
|
+
...DEFAULTS[scheme],
|
|
978
|
+
...Object.fromEntries(Object.entries(productFollowers[scheme]).map(([property, from]) => [property, palette[from[0]][from[1]]]))
|
|
979
|
+
});
|
|
980
|
+
const maps = {
|
|
981
|
+
dark: followed("dark"),
|
|
982
|
+
light: followed("light")
|
|
983
|
+
};
|
|
984
|
+
const failures = SCHEMES.flatMap((scheme) => [...kansoPairs, ...rolePairs].flatMap(([foreground, ground, target]) => {
|
|
985
|
+
const ratio = ratioOf(maps[scheme], foreground, ground);
|
|
986
|
+
return ratio < target ? [{
|
|
987
|
+
foreground,
|
|
988
|
+
ground,
|
|
989
|
+
ratio,
|
|
990
|
+
scheme,
|
|
991
|
+
target
|
|
992
|
+
}] : [];
|
|
993
|
+
}));
|
|
994
|
+
if (failures.length > 0) throw new ProductThemeError(failures);
|
|
995
|
+
const moved = Object.keys(maps.light).filter((property) => SCHEMES.some((scheme) => read(maps[scheme])[property] !== read(DEFAULTS[scheme])[property]));
|
|
996
|
+
const changesIn = (scheme) => Object.freeze(Object.fromEntries(moved.map((property) => [property, read(maps[scheme])[property]])));
|
|
997
|
+
return Object.freeze({
|
|
998
|
+
changes: Object.freeze({
|
|
999
|
+
dark: changesIn("dark"),
|
|
1000
|
+
light: changesIn("light")
|
|
1001
|
+
}),
|
|
1002
|
+
dark: Object.freeze(maps.dark),
|
|
1003
|
+
light: Object.freeze(maps.light),
|
|
1004
|
+
palette: Object.freeze({
|
|
1005
|
+
dark: Object.freeze({ ...palette.dark }),
|
|
1006
|
+
light: Object.freeze({ ...palette.light })
|
|
1007
|
+
})
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
export { light as a, dark as i, defineProductTheme as n, productRoles as o, breakpoints as r, ProductThemeError as t };
|
|
1011
|
+
|
|
1012
|
+
//# sourceMappingURL=product-theme-CfDDgv7F.js.map
|