@grafctory/skin 0.0.0-stage → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +469 -2
  3. package/dist/index.core.d.ts +201 -0
  4. package/dist/index.core.d.ts.map +1 -0
  5. package/dist/index.core.js +17 -0
  6. package/dist/index.core.js.map +1 -0
  7. package/dist/index.css +126 -0
  8. package/dist/index.d.ts +432 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +184 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/markup/alerts.css +83 -0
  13. package/dist/markup/blocks.css +255 -0
  14. package/dist/markup/forms.css +551 -0
  15. package/dist/markup/headings.css +131 -0
  16. package/dist/markup/highlights.css +38 -0
  17. package/dist/markup/inlines.css +183 -0
  18. package/dist/markup/lists.css +206 -0
  19. package/dist/markup/reset.css +38 -0
  20. package/dist/markup/tables.css +78 -0
  21. package/dist/presets/inter.css +194 -0
  22. package/dist/presets/roboto.css +198 -0
  23. package/dist/tokens/borders.css +151 -0
  24. package/dist/tokens/borders.d.ts +57 -0
  25. package/dist/tokens/borders.d.ts.map +1 -0
  26. package/dist/tokens/borders.js +72 -0
  27. package/dist/tokens/borders.js.map +1 -0
  28. package/dist/tokens/colors.css +515 -0
  29. package/dist/tokens/colors.d.ts +171 -0
  30. package/dist/tokens/colors.d.ts.map +1 -0
  31. package/dist/tokens/colors.js +186 -0
  32. package/dist/tokens/colors.js.map +1 -0
  33. package/dist/tokens/elevations.css +110 -0
  34. package/dist/tokens/elevations.d.ts +54 -0
  35. package/dist/tokens/elevations.d.ts.map +1 -0
  36. package/dist/tokens/elevations.js +69 -0
  37. package/dist/tokens/elevations.js.map +1 -0
  38. package/dist/tokens/layers.css +57 -0
  39. package/dist/tokens/layers.d.ts +34 -0
  40. package/dist/tokens/layers.d.ts.map +1 -0
  41. package/dist/tokens/layers.js +49 -0
  42. package/dist/tokens/layers.js.map +1 -0
  43. package/dist/tokens/motions.css +91 -0
  44. package/dist/tokens/motions.d.ts +40 -0
  45. package/dist/tokens/motions.d.ts.map +1 -0
  46. package/dist/tokens/motions.js +55 -0
  47. package/dist/tokens/motions.js.map +1 -0
  48. package/dist/tokens/opacities.css +41 -0
  49. package/dist/tokens/opacities.d.ts +32 -0
  50. package/dist/tokens/opacities.d.ts.map +1 -0
  51. package/dist/tokens/opacities.js +47 -0
  52. package/dist/tokens/opacities.js.map +1 -0
  53. package/dist/tokens/palettes.css +546 -0
  54. package/dist/tokens/palettes.d.ts +140 -0
  55. package/dist/tokens/palettes.d.ts.map +1 -0
  56. package/dist/tokens/palettes.js +155 -0
  57. package/dist/tokens/palettes.js.map +1 -0
  58. package/dist/tokens/scalings.css +81 -0
  59. package/dist/tokens/scalings.d.ts +31 -0
  60. package/dist/tokens/scalings.d.ts.map +1 -0
  61. package/dist/tokens/scalings.js +46 -0
  62. package/dist/tokens/scalings.js.map +1 -0
  63. package/dist/tokens/spacings.css +78 -0
  64. package/dist/tokens/spacings.d.ts +34 -0
  65. package/dist/tokens/spacings.d.ts.map +1 -0
  66. package/dist/tokens/spacings.js +49 -0
  67. package/dist/tokens/spacings.js.map +1 -0
  68. package/dist/tokens/typography.css +156 -0
  69. package/dist/tokens/typography.d.ts +77 -0
  70. package/dist/tokens/typography.d.ts.map +1 -0
  71. package/dist/tokens/typography.js +92 -0
  72. package/dist/tokens/typography.js.map +1 -0
  73. package/dist/tokens/viewports.css +101 -0
  74. package/dist/tokens/viewports.d.ts +75 -0
  75. package/dist/tokens/viewports.d.ts.map +1 -0
  76. package/dist/tokens/viewports.js +90 -0
  77. package/dist/tokens/viewports.js.map +1 -0
  78. package/package.json +87 -4
@@ -0,0 +1,515 @@
1
+ /*
2
+ * Copyright © 2023-2026 Metreeca srl
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ /*
18
+ * The anchors an app supplies its brand through, and the roles derived from them. A role says what a colour means in
19
+ * the interface, so a rule names the role it paints rather than the colour it paints in, and follows an app retuning
20
+ * the anchors.
21
+ */
22
+
23
+ /*
24
+ * The accents ship the Metreeca brand, a slate and an orange, which an app replaces with its own: the subtle one
25
+ * carries an interface at rest and the strong one marks a thing out, stating an emphasis relative to each other
26
+ * rather than an appearance. The light orange is darkened from the brand book's #D60, which held 3.51:1 on the page,
27
+ * until it holds AA on its own tints. The status colours are anchors of their own rather than derivations of an
28
+ * accent, so an outcome keeps reading as itself whatever an app brands with, in whichever hue it supplies.
29
+ *
30
+ * Each status colour is held to the WCAG budget of what it paints and to nothing past it. On the light page the
31
+ * note and pass colours are a blue and a green at the most chroma the gamut holds where they reach 4.5:1 on
32
+ * their own tint, the tightest surface they are set on, landing at 5.4:1 on the page. The flag is a violet at the
33
+ * chroma of the conventional purple an important notice takes, at the same 5.4:1, and the failure a crimson a shade
34
+ * deeper, at 5.86:1, since a red at full chroma glares on white. All four serve as text or mark on the page.
35
+ * The caution is a dark gold at 4.87:1 on the page, which reads as a warning where an orange turns red and a deeper
36
+ * gold turns brown. It holds AA on the page, the stripe, the edit field and the overlay, at 4.53:1 on the stripe,
37
+ * but only 4.16:1 on its own tint, so caution text is never set there in either scheme.
38
+ *
39
+ * The dark page takes the five hues again, each lifted to where it reaches 4.5:1 on the overlay, the tightest
40
+ * surface there, which lands every one at 5.4:1 on the page and above AA on its own tint. The note, pass and
41
+ * caution colours are at the most chroma the gamut holds at that lightness, the flag at the chroma of its light
42
+ * partner, and the failure a tenth under the gamut's, since a red at the gamut's edge glares on a dark page as much
43
+ * as on a light one. The caution is a gold rather than a yellow, so the one value serves as text, mark and fill on
44
+ * the dark page as it does on the light one, and holds its tint there too, at 4.88:1.
45
+ *
46
+ * An app supplying its brand states a light-dark() pair too, and rechecks AA text contrast on page and stripe in both.
47
+ */
48
+
49
+ /*
50
+ * Each anchor states both schemes in one value, as light-dark(light, dark), and neither scheme is the default of the
51
+ * other. The value is held unresolved and picked where a rule paints with it, according to the color-scheme in force
52
+ * there: index.css settles that from the platform and from any data-scheme attribute, so a pinned subtree or a pinned
53
+ * root takes its own side of the pair with no rule restating the anchor for it. An app overrides an anchor the same
54
+ * way, once, and the override follows every scheme and every pinning.
55
+ *
56
+ * The anchors are registered as "*" for the same reason: a registered <color> would resolve the pair where it is
57
+ * declared, on the root, and hand every subtree the side the page happened to be on.
58
+ *
59
+ * The focus mark carries a literal pair alongside them, for the reason the status colours do: it says where the
60
+ * keyboard stands, which is the same thing to say whatever an app brands with, and a mark taking the accent would
61
+ * shift under a rebrand that has nothing to do with it. It is a cool grey, apart from the shipped accents, so it reads
62
+ * as a mark rather than as a rule the page happened to grow, whichever brand the page around it is painted in.
63
+ */
64
+
65
+ @property --skin--color {
66
+ syntax: "*";
67
+ inherits: true;
68
+ initial-value: light-dark(#000, #EEE);
69
+ }
70
+
71
+ @property --skin--background-color {
72
+ syntax: "*";
73
+ inherits: true;
74
+ initial-value: light-dark(#FFF, #111);
75
+ }
76
+
77
+ @property --skin--color-subtle {
78
+ syntax: "*";
79
+ inherits: true;
80
+ initial-value: light-dark(#345, #9AB);
81
+ }
82
+
83
+ @property --skin--color-strong {
84
+ syntax: "*";
85
+ inherits: true;
86
+ initial-value: light-dark(#B74300, #F80);
87
+ }
88
+
89
+ @property --skin--color-note {
90
+ syntax: "*";
91
+ inherits: true;
92
+ initial-value: light-dark(#0066D8, #2F88FF);
93
+ }
94
+
95
+ @property --skin--color-pass {
96
+ syntax: "*";
97
+ inherits: true;
98
+ initial-value: light-dark(#0B7C00, #11A000);
99
+ }
100
+
101
+ @property --skin--color-flag {
102
+ syntax: "*";
103
+ inherits: true;
104
+ initial-value: light-dark(#7E4ADC, #9D6EFF);
105
+ }
106
+
107
+ @property --skin--color-warn {
108
+ syntax: "*";
109
+ inherits: true;
110
+ initial-value: light-dark(#9A6700, #BB7E00);
111
+ }
112
+
113
+ @property --skin--color-fail {
114
+ syntax: "*";
115
+ inherits: true;
116
+ initial-value: light-dark(#C3222A, #F74B4A);
117
+ }
118
+
119
+ @property --skin--color-focus {
120
+ syntax: "*";
121
+ inherits: true;
122
+ initial-value: light-dark(#75818C, #6B757E);
123
+ }
124
+
125
+
126
+ /* Every role derives from an anchor, following a retuned brand in either scheme, with no type or initial value. */
127
+
128
+ @property --skin--color-label {
129
+ syntax: "*";
130
+ inherits: true;
131
+ }
132
+
133
+ @property --skin--color-placeholder {
134
+ syntax: "*";
135
+ inherits: true;
136
+ }
137
+
138
+ @property --skin--color-enabled {
139
+ syntax: "*";
140
+ inherits: true;
141
+ }
142
+
143
+ @property --skin--color-disabled {
144
+ syntax: "*";
145
+ inherits: true;
146
+ }
147
+
148
+ @property --skin--color-link {
149
+ syntax: "*";
150
+ inherits: true;
151
+ }
152
+
153
+ @property --skin--color-link-hover {
154
+ syntax: "*";
155
+ inherits: true;
156
+ }
157
+
158
+ @property --skin--color-hover {
159
+ syntax: "*";
160
+ inherits: true;
161
+ }
162
+
163
+ @property --skin--color-pressed {
164
+ syntax: "*";
165
+ inherits: true;
166
+ }
167
+
168
+ @property --skin--color-selected {
169
+ syntax: "*";
170
+ inherits: true;
171
+ }
172
+
173
+ @property --skin--color-over {
174
+ syntax: "*";
175
+ inherits: true;
176
+ }
177
+
178
+ @property --skin--color-strong-over {
179
+ syntax: "*";
180
+ inherits: true;
181
+ }
182
+
183
+ @property --skin--color-note-stroke {
184
+ syntax: "*";
185
+ inherits: true;
186
+ }
187
+
188
+ @property --skin--color-pass-stroke {
189
+ syntax: "*";
190
+ inherits: true;
191
+ }
192
+
193
+ @property --skin--color-flag-stroke {
194
+ syntax: "*";
195
+ inherits: true;
196
+ }
197
+
198
+ @property --skin--color-warn-stroke {
199
+ syntax: "*";
200
+ inherits: true;
201
+ }
202
+
203
+ @property --skin--color-fail-stroke {
204
+ syntax: "*";
205
+ inherits: true;
206
+ }
207
+
208
+ @property --skin--background-color-edit {
209
+ syntax: "*";
210
+ inherits: true;
211
+ }
212
+
213
+ @property --skin--background-color-stripe {
214
+ syntax: "*";
215
+ inherits: true;
216
+ }
217
+
218
+ @property --skin--background-color-hover {
219
+ syntax: "*";
220
+ inherits: true;
221
+ }
222
+
223
+ @property --skin--background-color-pressed {
224
+ syntax: "*";
225
+ inherits: true;
226
+ }
227
+
228
+ @property --skin--background-color-selected {
229
+ syntax: "*";
230
+ inherits: true;
231
+ }
232
+
233
+ @property --skin--background-color-hover-neutral {
234
+ syntax: "*";
235
+ inherits: true;
236
+ }
237
+
238
+ @property --skin--background-color-pressed-neutral {
239
+ syntax: "*";
240
+ inherits: true;
241
+ }
242
+
243
+ @property --skin--background-color-note {
244
+ syntax: "*";
245
+ inherits: true;
246
+ }
247
+
248
+ @property --skin--background-color-pass {
249
+ syntax: "*";
250
+ inherits: true;
251
+ }
252
+
253
+ @property --skin--background-color-flag {
254
+ syntax: "*";
255
+ inherits: true;
256
+ }
257
+
258
+ @property --skin--background-color-warn {
259
+ syntax: "*";
260
+ inherits: true;
261
+ }
262
+
263
+ @property --skin--background-color-fail {
264
+ syntax: "*";
265
+ inherits: true;
266
+ }
267
+
268
+ /*
269
+ * A role painting text in an accent derives from it in oklch rather than by a mix towards the page, which spends the
270
+ * lightness it needs to hold AA contrast. A role whose share differs by scheme states a light-dark() pair of
271
+ * derivations rather than a rule per scheme, so a pinned subtree follows it with nothing restated.
272
+ *
273
+ * A role mixing the text anchor towards the page takes more of it in the dark scheme than in the light one, because
274
+ * the two ends behave nothing alike: white carries almost all the luminance in the range, so mixing away from black
275
+ * spends contrast slowly, while mixing away from #EEE towards #111 spends it fast. One share would be pinned by the
276
+ * dark scheme and leave the light one far darker than it needs to be, so each role held to a budget sets the offset
277
+ * its own budget calls for. The disabled colour is held to no budget, and takes the offset of secondary text.
278
+ */
279
+
280
+ :root {
281
+
282
+ /*
283
+ * Each share is pinned by the tightest surface secondary text is set on, the pressed tint in either scheme, at
284
+ * 5.53:1 in the light one and 4.58:1 in the dark one, where the overlay surface holds 4.66:1.
285
+ */
286
+
287
+ --skin--color-label: light-dark(
288
+ color-mix(in oklab, var(--skin--color) 52%, var(--skin--background-color)),
289
+ color-mix(in oklab, var(--skin--color) 60%, var(--skin--background-color))
290
+ );
291
+
292
+ /*
293
+ * Text over the caution fill takes the page background: white over the light gold, at 4.87:1, and the dark page
294
+ * over the dark gold, at 5.48:1. A fill painted in the failure flips as the strong fill does, white at 5.86:1 in
295
+ * the light scheme and black at 5.45:1 in the dark one, where white would fall to 3.47:1 over the lighter red.
296
+ */
297
+
298
+ --skin--color-over: var(--skin--background-color);
299
+
300
+ /*
301
+ * Text over a strong fill takes white or black, whichever contrasts more with the fill, since a brand may supply
302
+ * an accent on either side of the crossover. The flip reads the y channel, the WCAG relative luminance, at
303
+ * 0.1791, where the two contrast equally, so it holds 4.58:1 at worst whatever the hue. The shipped orange takes
304
+ * white at 5.50:1 in the light scheme and black at 8.77:1 in the dark one. The factors scale the D65 white point.
305
+ */
306
+
307
+ --skin--color-strong-over: color(from var(--skin--color-strong) xyz-d65
308
+ calc(0.9505 * clamp(0, (0.1791 - y) * 1000, 1))
309
+ clamp(0, (0.1791 - y) * 1000, 1)
310
+ calc(1.0888 * clamp(0, (0.1791 - y) * 1000, 1))
311
+ );
312
+
313
+ /*
314
+ * Status text takes a stroke role, held to AA contrast on the page, the stripe, the overlay and the tint of its
315
+ * own step, and to nothing past it: a stroke carried beyond 4.5:1 on the tightest of them spends chroma on
316
+ * contrast no reader needs. A label a widget sets over any other fill is the widget's to hold to AA there.
317
+ *
318
+ * In both schemes every stroke is its anchor, which sits at the budget on its tightest surface: the tint on the
319
+ * light page and the overlay on the dark one. The light caution alone falls short, on its tint, where caution
320
+ * text is never set. The role stays apart from the anchor all the same, so a brand needing a stroke of its own
321
+ * sets one at the role, and no consumer rewrites a call site to follow a value that moved under it.
322
+ *
323
+ * light: page stripe tint dark: page stripe tint overlay
324
+ * note 5.40 5.02 4.58 5.47 5.15 4.87 4.54
325
+ * pass 5.39 5.01 4.56 5.44 5.12 4.79 4.51
326
+ * flag 5.38 5.01 4.57 5.49 5.17 4.92 4.55
327
+ * warn 4.87 4.53 4.16 5.48 5.16 4.88 4.54
328
+ * fail 5.86 5.45 4.93 5.45 5.13 4.90 4.52
329
+ */
330
+
331
+ --skin--color-note-stroke: var(--skin--color-note);
332
+ --skin--color-pass-stroke: var(--skin--color-pass);
333
+ --skin--color-flag-stroke: var(--skin--color-flag);
334
+ --skin--color-warn-stroke: var(--skin--color-warn);
335
+ --skin--color-fail-stroke: var(--skin--color-fail);
336
+
337
+ /*
338
+ * A placeholder is text, so it holds AA wherever a field sits: the shares are the lightest at 4.5:1 on the stripe,
339
+ * the tightest surface, at 4.71:1 there and 5.06:1 on the page in the light scheme, 4.68:1 and 4.97:1 in the dark
340
+ * one. That still leaves it well short of an entered value, which takes the full text anchor. The same shares
341
+ * set `small` text apart from prose, on the same surfaces and to the same budget.
342
+ */
343
+
344
+ --skin--color-placeholder: light-dark(
345
+ color-mix(in oklab, var(--skin--color) 46%, var(--skin--background-color)),
346
+ color-mix(in oklab, var(--skin--color) 56%, var(--skin--background-color))
347
+ );
348
+
349
+ /*
350
+ * The enabled colour, marking a control that answers, takes the hue of the subtle accent at a richer chroma and
351
+ * lifted towards the page, so it stands out from the text around it while following a retuned brand. The lift
352
+ * is what keeps it off the links, which take the same hue at a lightness of their own: it sits ΔE 6.1 and 10.4
353
+ * from a link at rest in the light and the dark scheme, 13 and 18 from one under the pointer. It holds AA contrast
354
+ * at 5.99:1 on the page, 5.58:1 on the stripe and 5.66:1 on the edit background in the light scheme, and 5.89:1,
355
+ * 5.54:1 and 5.72:1 in the dark one, the stripe being the tightest surface it is set on in either scheme. The
356
+ * chroma is capped where the gamut ends at that lightness, so every browser paints one colour.
357
+ */
358
+
359
+ --skin--color-enabled: light-dark(
360
+ oklch(from var(--skin--color-subtle) calc(l + 0.12) min(calc(c * 3), 0.11) h),
361
+ oklch(from var(--skin--color-subtle) calc(l - 0.08) min(calc(c * 3), 0.11) h)
362
+ );
363
+
364
+ --skin--color-disabled: light-dark(
365
+ color-mix(in oklab, var(--skin--color) 19%, var(--skin--background-color)),
366
+ color-mix(in oklab, var(--skin--color) 23.5%, var(--skin--background-color))
367
+ );
368
+
369
+ /*
370
+ * A link takes the hue of the subtle accent at a richer chroma and at a lightness of its own: an app retuning the
371
+ * accent moves the hue alone, never the contrast. The pointer moves the link away from the page in lightness,
372
+ * deeper in the light scheme and lighter in the dark one, and richer still in chroma, so the step reads as a
373
+ * colour change rather than as a fade towards the page text. The caps keep the chroma inside the gamut at that
374
+ * lightness, so every browser paints one colour. Figures for the shipped accent:
375
+ *
376
+ * page stripe text
377
+ * light rest 7.40 6.89 2.84
378
+ * hover 10.4 9.68 2.02
379
+ * dark rest 8.54 8.04 1.91
380
+ * hover 11.3 10.6 1.45
381
+ */
382
+
383
+ --skin--color-link: light-dark(
384
+ oklch(from var(--skin--color-subtle) 0.45 min(calc(c * 2), 0.1) h),
385
+ oklch(from var(--skin--color-subtle) 0.75 min(calc(c * 2), 0.1) h)
386
+ );
387
+
388
+ --skin--color-link-hover: light-dark(
389
+ oklch(from var(--skin--color-subtle) 0.37 min(calc(c * 3), 0.08) h),
390
+ oklch(from var(--skin--color-subtle) 0.83 min(calc(c * 3), 0.08) h)
391
+ );
392
+
393
+ /*
394
+ * A control under the pointer or the press is the strong accent carried towards the page text, the press further
395
+ * than the pointer: away from the page in either scheme, since the text anchor swaps sides with it, and inside the
396
+ * gamut, since a mix of two colours the page can paint stays paintable. Stepping the lightness instead left the
397
+ * gamut, and each browser then painted its own colour: Chrome and Firefox clip the channels, which in the dark
398
+ * scheme turned the pressed orange into the caution amber at ΔE 1.9, while Safari reduces the chroma.
399
+ *
400
+ * The dark steps are smaller, ΔE 5.5 each against 11 in the light scheme, since a bright saturated accent has
401
+ * little room above it; a control fills its box with the state tints as well, so the state never rests on the
402
+ * text colour alone. The figures below hold for the shipped orange, and an app supplying its own rechecks them:
403
+ *
404
+ * page stripe own tint
405
+ * light hover 8.60 8.00 7.92
406
+ * press 13.1 12.2 11.0
407
+ * dark hover 9.25 8.71 8.24
408
+ * press 10.8 10.1 8.75
409
+ */
410
+
411
+ --skin--color-hover: color-mix(in oklab, var(--skin--color-strong) 80%, var(--skin--color));
412
+ --skin--color-pressed: color-mix(in oklab, var(--skin--color-strong) 60%, var(--skin--color));
413
+ --skin--color-selected: var(--skin--color-strong);
414
+
415
+ /*
416
+ * The three states above answer to the strong accent, so a brand carries them along. The fourth, the focus mark,
417
+ * is stated per scheme with the anchors instead: it holds a value of its own that a rebrand leaves standing, and
418
+ * holds 3:1 on every surface it is drawn against, the tightest being the pressed tint at 3.37:1 in the light
419
+ * scheme and 3.27:1 in the dark one, against 3.98:1 and 4.02:1 on the page. No grey holds against a solid fill,
420
+ * an accent or a step of the meaning scale alike, so a component filling a control solid offsets the ring
421
+ * outside the fill by the line width, against the page, rather than inside it as the base controls draw it.
422
+ */
423
+
424
+ --skin--background-color-edit: color-mix(in oklab, var(--skin--background-color) 98%, var(--skin--color));
425
+ --skin--background-color-stripe: light-dark(
426
+ color-mix(in oklab, var(--skin--background-color) 97.5%, var(--skin--color)),
427
+ color-mix(in oklab, var(--skin--background-color) 96%, var(--skin--color))
428
+ );
429
+
430
+ /*
431
+ * A filled state tints the page with the strong accent rather than the text anchor, so the fill says which accent
432
+ * the control answers to. The shares stay light enough for the accent itself to hold AA contrast on its own tint,
433
+ * so a label needs no second colour: 4.65:1 at the heaviest for the shipped orange in the light scheme and 6.42:1
434
+ * in the dark one, figures an app supplying an accent of its own rechecks for that accent.
435
+ *
436
+ * The dark shares are heavier, since a share that tints a white page reads as a grey on a dark one, and boost
437
+ * the chroma the mix leaves, as the status tints do, so the fill reads as the accent rather than as a brown. The
438
+ * label caps them: the pressed fill rises a hair past the overlay's lightness, to where the label holds 4.58:1 and
439
+ * the focus ring 3.27:1 on it, and no further. The boost stops while the pressed fill is still inside the gamut,
440
+ * and scales a and b rather than the OKLCh chroma for the reason the tints do: Chrome drops the hue of a colour
441
+ * this grey and paints a relative oklch() reading it as a red, which no evaluator outside a browser predicts.
442
+ */
443
+
444
+ --skin--background-color-hover: light-dark(
445
+ color-mix(in oklab, var(--skin--color-strong) 6%, var(--skin--background-color)),
446
+ oklab(from color-mix(in oklab, var(--skin--color-strong) 10%, var(--skin--background-color)) l calc(a * 2) calc(b * 2))
447
+ );
448
+ --skin--background-color-selected: light-dark(
449
+ color-mix(in oklab, var(--skin--color-strong) 10%, var(--skin--background-color)),
450
+ oklab(from color-mix(in oklab, var(--skin--color-strong) 13%, var(--skin--background-color)) l calc(a * 2) calc(b * 2))
451
+ );
452
+ --skin--background-color-pressed: light-dark(
453
+ color-mix(in oklab, var(--skin--color-strong) 12%, var(--skin--background-color)),
454
+ oklab(from color-mix(in oklab, var(--skin--color-strong) 16%, var(--skin--background-color)) l calc(a * 2) calc(b * 2))
455
+ );
456
+
457
+ /*
458
+ * A control answering to no accent is told apart by lightness alone, so its states are laid over the surface it
459
+ * stands on rather than mixed into the page. A tint mixed into the page reads on the page and nowhere else: the
460
+ * sunken surface already sits a step from the page in the direction the tint travels, so the two all but meet
461
+ * there. Each state is page ink at a share of cover instead, deepening any surface by the same step whatever the
462
+ * surface the control happens to stand on, and the press deepening it further than the hover.
463
+ *
464
+ * The shares are the heaviest at which the label, an enabled control and the focus ring hold their budgets over
465
+ * the pressed state on the page, the stripe, the edit field and the sunken surface: the tightest is the sunken
466
+ * surface in the light scheme, at 4.54:1 and 3.02:1, and the stripe in the dark one, at 4.52:1 and 3.06:1. The
467
+ * dark overlay leaves no room for a visible step, the label sitting at 4.66:1 on it bare, so a control set on a
468
+ * menu, a popover or a dialog takes the accent states above instead of these.
469
+ */
470
+
471
+ --skin--background-color-hover-neutral: light-dark(
472
+ color-mix(in oklab, var(--skin--color) 4.25%, transparent),
473
+ color-mix(in oklab, var(--skin--color) 3.25%, transparent)
474
+ );
475
+ --skin--background-color-pressed-neutral: light-dark(
476
+ color-mix(in oklab, var(--skin--color) 8.5%, transparent),
477
+ color-mix(in oklab, var(--skin--color) 6.5%, transparent)
478
+ );
479
+
480
+ /*
481
+ * A status tint takes the same share whichever outcome it carries, so five notices read as one family. In the
482
+ * light scheme the note, pass, flag and failure colours hold AA contrast on their own tints, at 4.56:1 at the
483
+ * tightest, and in the dark one all five do, at 4.79:1. The page text holds 17.8:1 and 14.3:1 on every tint.
484
+ *
485
+ * A light tint is the mix as it comes: a hair under white, it has no room for more chroma. A dark tint is the
486
+ * same mix with its chroma boosted, which the gamut holds at that lightness for every step: the plain mix left a
487
+ * quarter of the anchor's chroma on the dark page, where any dim gold reads as brown and any dim red as a grey,
488
+ * and the notices read as so many greys. The label and the focus ring hold on every tint in both schemes, at
489
+ * 4.96:1 and 3.54:1 on the tightest, the dark pass, and at 5.50:1 and 3.35:1 on the light tints. The boost scales
490
+ * a and b rather than the OKLCh chroma, since Chrome drops the hue of a colour this grey, which a relative oklch()
491
+ * reading it would then paint as a red, and no evaluator outside a browser predicts it.
492
+ */
493
+
494
+ --skin--background-color-note: light-dark(
495
+ color-mix(in oklab, var(--skin--color-note) 12%, var(--skin--background-color)),
496
+ oklab(from color-mix(in oklab, var(--skin--color-note) 12%, var(--skin--background-color)) l calc(a * 2.5) calc(b * 2.5))
497
+ );
498
+ --skin--background-color-pass: light-dark(
499
+ color-mix(in oklab, var(--skin--color-pass) 12%, var(--skin--background-color)),
500
+ oklab(from color-mix(in oklab, var(--skin--color-pass) 12%, var(--skin--background-color)) l calc(a * 2.5) calc(b * 2.5))
501
+ );
502
+ --skin--background-color-flag: light-dark(
503
+ color-mix(in oklab, var(--skin--color-flag) 12%, var(--skin--background-color)),
504
+ oklab(from color-mix(in oklab, var(--skin--color-flag) 12%, var(--skin--background-color)) l calc(a * 2.5) calc(b * 2.5))
505
+ );
506
+ --skin--background-color-fail: light-dark(
507
+ color-mix(in oklab, var(--skin--color-fail) 12%, var(--skin--background-color)),
508
+ oklab(from color-mix(in oklab, var(--skin--color-fail) 12%, var(--skin--background-color)) l calc(a * 2.5) calc(b * 2.5))
509
+ );
510
+ --skin--background-color-warn: light-dark(
511
+ color-mix(in oklab, var(--skin--color-warn) 12%, var(--skin--background-color)),
512
+ oklab(from color-mix(in oklab, var(--skin--color-warn) 12%, var(--skin--background-color)) l calc(a * 2.5) calc(b * 2.5))
513
+ );
514
+
515
+ }