@atom63/styles 0.1.0-beta.8 → 0.1.0-beta.9

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.
@@ -43,6 +43,9 @@
43
43
  --a63-status-success-foreground: white;
44
44
  --a63-status-warning: var(--warning, oklch(0.75 0.15 80));
45
45
  --a63-status-warning-foreground: white;
46
+ --a63-status-danger: var(--destructive);
47
+ --a63-status-danger-foreground: var(--destructive-foreground, white);
48
+ --a63-text-danger: var(--destructive);
46
49
 
47
50
  --a63-scrim: color-mix(in oklch, black 40%, transparent);
48
51
  /* Shadow, media and on-media colors hold in every theme; same values as semantics.css. */
@@ -129,6 +132,263 @@
129
132
  --a63-brand-800: color-mix(in oklch, var(--primary) 60%, black);
130
133
  --a63-brand-900: color-mix(in oklch, var(--primary) 46%, black);
131
134
  --a63-brand-950: color-mix(in oklch, var(--primary) 34%, black);
135
+
136
+ /* ── Every other token the ui-react recipes read without a fallback ───── *
137
+ * recipes.test.ts fails when a recipe reads an --a63-* token this file does
138
+ * not define. Colors derive from shadcn variables, so they follow the
139
+ * host's light and dark mode; scales copy the foundation's default values. */
140
+
141
+ /* Text, surface and selection roles. */
142
+ --a63-text-accent: var(--primary);
143
+ --a63-surface-recessed: var(--muted);
144
+ --a63-selected-background: var(--a63-surface-muted);
145
+ --a63-selected-foreground: var(--a63-text-primary);
146
+ --a63-selected-accent-background: color-mix(in oklch, var(--primary) 12%, transparent);
147
+ --a63-selected-accent-foreground: var(--a63-text-accent);
148
+ --a63-selection-thumb: white;
149
+ --a63-alert-background: transparent;
150
+ --a63-choice-card-checked-border: color-mix(in oklch, var(--primary) 30%, transparent);
151
+ --a63-choice-card-checked-background: color-mix(in oklch, var(--primary) 5%, transparent);
152
+ --a63-control-outline-background: var(--background);
153
+ --a63-control-outline-hover-background: color-mix(in oklab, var(--accent) 50%, transparent);
154
+ --a63-control-outline-hover-border: var(--border);
155
+ --a63-skeleton-base: var(--a63-surface-muted);
156
+ --a63-skeleton-highlight: color-mix(in oklch, var(--background) 60%, transparent);
157
+
158
+ /* Disabled and subtle action / status roles. Subtle foregrounds mix the hue
159
+ toward --foreground, so they darken in light mode and lighten in dark. */
160
+ --a63-action-disabled-background: var(--a63-surface-muted);
161
+ --a63-action-disabled-border: var(--a63-border-subtle);
162
+ --a63-action-disabled-foreground: var(--muted-foreground);
163
+ --a63-action-danger-subtle: color-mix(in oklab, var(--a63-action-danger) 14%, transparent);
164
+ --a63-action-danger-subtle-foreground: color-mix(
165
+ in oklch,
166
+ var(--a63-action-danger) 75%,
167
+ var(--foreground)
168
+ );
169
+ --a63-status-info-subtle: color-mix(in oklab, var(--a63-status-info) 14%, transparent);
170
+ --a63-status-info-subtle-foreground: color-mix(
171
+ in oklch,
172
+ var(--a63-status-info) 70%,
173
+ var(--foreground)
174
+ );
175
+ --a63-status-success-subtle: color-mix(in oklab, var(--a63-status-success) 14%, transparent);
176
+ --a63-status-success-subtle-foreground: color-mix(
177
+ in oklch,
178
+ var(--a63-status-success) 65%,
179
+ var(--foreground)
180
+ );
181
+ --a63-status-warning-subtle: color-mix(in oklab, var(--a63-status-warning) 14%, transparent);
182
+ --a63-status-warning-subtle-foreground: color-mix(
183
+ in oklch,
184
+ var(--a63-status-warning) 60%,
185
+ var(--foreground)
186
+ );
187
+
188
+ /* Category palette: the foundation's 500 hues; -subtle washes and
189
+ -subtle-foreground text derive from them as above. */
190
+ --a63-category-red: oklch(0.637 0.237 25.331);
191
+ --a63-category-orange: oklch(0.705 0.213 47.604);
192
+ --a63-category-amber: rgb(243 159 0);
193
+ --a63-category-yellow: oklch(0.795 0.184 86.047);
194
+ --a63-category-lime: oklch(0.768 0.233 130.85);
195
+ --a63-category-green: oklch(0.723 0.219 149.579);
196
+ --a63-category-emerald: oklch(0.696 0.17 162.48);
197
+ --a63-category-teal: oklch(0.704 0.14 182.503);
198
+ --a63-category-cyan: oklch(0.715 0.143 215.221);
199
+ --a63-category-sky: oklch(0.685 0.169 237.323);
200
+ --a63-category-blue: oklch(0.623 0.214 259.815);
201
+ --a63-category-indigo: oklch(0.585 0.233 277.117);
202
+ --a63-category-violet: oklch(0.606 0.25 292.717);
203
+ --a63-category-purple: oklch(0.627 0.265 303.9);
204
+ --a63-category-fuchsia: oklch(0.667 0.295 322.15);
205
+ --a63-category-pink: oklch(0.656 0.241 354.308);
206
+ --a63-category-rose: oklch(0.645 0.246 16.439);
207
+ --a63-category-neutral: oklch(0.556 0 0);
208
+ --a63-category-red-subtle: color-mix(in oklab, var(--a63-category-red) 14%, transparent);
209
+ --a63-category-orange-subtle: color-mix(in oklab, var(--a63-category-orange) 14%, transparent);
210
+ --a63-category-amber-subtle: color-mix(in oklab, var(--a63-category-amber) 14%, transparent);
211
+ --a63-category-yellow-subtle: color-mix(in oklab, var(--a63-category-yellow) 14%, transparent);
212
+ --a63-category-lime-subtle: color-mix(in oklab, var(--a63-category-lime) 14%, transparent);
213
+ --a63-category-green-subtle: color-mix(in oklab, var(--a63-category-green) 14%, transparent);
214
+ --a63-category-emerald-subtle: color-mix(in oklab, var(--a63-category-emerald) 14%, transparent);
215
+ --a63-category-teal-subtle: color-mix(in oklab, var(--a63-category-teal) 14%, transparent);
216
+ --a63-category-cyan-subtle: color-mix(in oklab, var(--a63-category-cyan) 14%, transparent);
217
+ --a63-category-sky-subtle: color-mix(in oklab, var(--a63-category-sky) 14%, transparent);
218
+ --a63-category-blue-subtle: color-mix(in oklab, var(--a63-category-blue) 14%, transparent);
219
+ --a63-category-indigo-subtle: color-mix(in oklab, var(--a63-category-indigo) 14%, transparent);
220
+ --a63-category-violet-subtle: color-mix(in oklab, var(--a63-category-violet) 14%, transparent);
221
+ --a63-category-purple-subtle: color-mix(in oklab, var(--a63-category-purple) 14%, transparent);
222
+ --a63-category-fuchsia-subtle: color-mix(in oklab, var(--a63-category-fuchsia) 14%, transparent);
223
+ --a63-category-pink-subtle: color-mix(in oklab, var(--a63-category-pink) 14%, transparent);
224
+ --a63-category-rose-subtle: color-mix(in oklab, var(--a63-category-rose) 14%, transparent);
225
+ --a63-category-neutral-subtle: color-mix(in oklab, var(--a63-category-neutral) 14%, transparent);
226
+ --a63-category-red-subtle-foreground: color-mix(
227
+ in oklch,
228
+ var(--a63-category-red) 70%,
229
+ var(--foreground)
230
+ );
231
+ --a63-category-orange-subtle-foreground: color-mix(
232
+ in oklch,
233
+ var(--a63-category-orange) 60%,
234
+ var(--foreground)
235
+ );
236
+ --a63-category-amber-subtle-foreground: color-mix(
237
+ in oklch,
238
+ var(--a63-category-amber) 60%,
239
+ var(--foreground)
240
+ );
241
+ --a63-category-yellow-subtle-foreground: color-mix(
242
+ in oklch,
243
+ var(--a63-category-yellow) 55%,
244
+ var(--foreground)
245
+ );
246
+ --a63-category-lime-subtle-foreground: color-mix(
247
+ in oklch,
248
+ var(--a63-category-lime) 55%,
249
+ var(--foreground)
250
+ );
251
+ --a63-category-green-subtle-foreground: color-mix(
252
+ in oklch,
253
+ var(--a63-category-green) 60%,
254
+ var(--foreground)
255
+ );
256
+ --a63-category-emerald-subtle-foreground: color-mix(
257
+ in oklch,
258
+ var(--a63-category-emerald) 60%,
259
+ var(--foreground)
260
+ );
261
+ --a63-category-teal-subtle-foreground: color-mix(
262
+ in oklch,
263
+ var(--a63-category-teal) 60%,
264
+ var(--foreground)
265
+ );
266
+ --a63-category-cyan-subtle-foreground: color-mix(
267
+ in oklch,
268
+ var(--a63-category-cyan) 60%,
269
+ var(--foreground)
270
+ );
271
+ --a63-category-sky-subtle-foreground: color-mix(
272
+ in oklch,
273
+ var(--a63-category-sky) 65%,
274
+ var(--foreground)
275
+ );
276
+ --a63-category-blue-subtle-foreground: color-mix(
277
+ in oklch,
278
+ var(--a63-category-blue) 70%,
279
+ var(--foreground)
280
+ );
281
+ --a63-category-indigo-subtle-foreground: color-mix(
282
+ in oklch,
283
+ var(--a63-category-indigo) 70%,
284
+ var(--foreground)
285
+ );
286
+ --a63-category-violet-subtle-foreground: color-mix(
287
+ in oklch,
288
+ var(--a63-category-violet) 70%,
289
+ var(--foreground)
290
+ );
291
+ --a63-category-purple-subtle-foreground: color-mix(
292
+ in oklch,
293
+ var(--a63-category-purple) 70%,
294
+ var(--foreground)
295
+ );
296
+ --a63-category-fuchsia-subtle-foreground: color-mix(
297
+ in oklch,
298
+ var(--a63-category-fuchsia) 70%,
299
+ var(--foreground)
300
+ );
301
+ --a63-category-pink-subtle-foreground: color-mix(
302
+ in oklch,
303
+ var(--a63-category-pink) 70%,
304
+ var(--foreground)
305
+ );
306
+ --a63-category-rose-subtle-foreground: color-mix(
307
+ in oklch,
308
+ var(--a63-category-rose) 70%,
309
+ var(--foreground)
310
+ );
311
+ --a63-category-neutral-subtle-foreground: color-mix(
312
+ in oklch,
313
+ var(--a63-category-neutral) 60%,
314
+ var(--foreground)
315
+ );
316
+
317
+ /* Flat surface and overlay archetype: no gloss, texture or backdrop blur. */
318
+ --a63-surface-backdrop: none;
319
+ --a63-surface-gloss: none;
320
+ --a63-surface-texture-image: none;
321
+ --a63-surface-texture-blend: normal;
322
+ --a63-surface-border-style: solid;
323
+ --a63-surface-border-width: 1px;
324
+ --a63-surface-raised-shadow: var(--a63-overlay-shadow);
325
+ --a63-overlay-backdrop: none;
326
+ --a63-overlay-gloss: none;
327
+ --a63-overlay-texture-image: none;
328
+ --a63-overlay-texture-blend: normal;
329
+ --a63-overlay-border-style: solid;
330
+ --a63-overlay-border-width: 1px;
331
+ --a63-menu-highlight-gloss: none;
332
+ --a63-menu-highlight-shadow: none;
333
+ --a63-menu-disabled-opacity: 0.56;
334
+ --a63-trigger-open-shadow: 0 0 #0000;
335
+ --a63-trigger-focus-ring-width: var(--a63-control-focus-ring-width);
336
+ --a63-trigger-feedback-duration: var(--a63-control-feedback-duration);
337
+ --a63-trigger-feedback-ease: var(--a63-control-feedback-ease);
338
+
339
+ /* Control details. */
340
+ --a63-control-text-shadow: none;
341
+ --a63-control-shadow-tint: 0%;
342
+ --a63-control-press-transform: translateY(1px);
343
+ --a63-control-feedback-duration: var(--a63-motion-duration-fast);
344
+ --a63-control-feedback-ease: var(--a63-motion-ease-standard);
345
+ --a63-control-icon-size-xs: 0.75rem;
346
+ --a63-control-icon-size-sm: 0.875rem;
347
+ --a63-control-icon-size-md: 1rem;
348
+ --a63-control-icon-size-lg: 1.125rem;
349
+ --a63-control-icon-size-xl: 1.25rem;
350
+ --a63-control-icon-only-size-xs: 0.875rem;
351
+ --a63-control-icon-only-size-sm: 1rem;
352
+ --a63-control-icon-only-size-md: 1.125rem;
353
+ --a63-control-icon-only-size-lg: 1.25rem;
354
+ --a63-control-icon-only-size-xl: 1.375rem;
355
+ --a63-switch-thumb-size: 1rem;
356
+ --a63-row-padding-block-xs: var(--a63-space-2);
357
+ --a63-row-padding-block-sm: var(--a63-space-3);
358
+ --a63-row-padding-block-md: var(--a63-space-4);
359
+ --a63-inset-row-min-size: calc(var(--a63-space-unit) * 13);
360
+
361
+ /* Space half steps, type and motion. */
362
+ --a63-space-0_5: 0.125rem;
363
+ --a63-space-1_5: 0.375rem;
364
+ --a63-space-2_5: 0.625rem;
365
+ --a63-space-3_5: 0.875rem;
366
+ --a63-font-app: inherit;
367
+ --a63-type-display-font-size: 2.5rem;
368
+ --a63-type-display-line-height: 2.75rem;
369
+ --a63-type-display-font-weight: 600;
370
+ --a63-type-display-font-weight-strong: 700;
371
+ --a63-type-display-large-font-size: 3.5rem;
372
+ --a63-type-display-large-line-height: 3.75rem;
373
+ --a63-type-display-large-font-weight: 600;
374
+ --a63-type-display-large-font-weight-strong: 700;
375
+ --a63-motion-duration-fast: 150ms;
376
+ --a63-motion-duration-overlay: 450ms;
377
+ --a63-motion-duration-swipe-dismiss: 400ms;
378
+ --a63-motion-ease-standard: cubic-bezier(0.2, 0, 0, 1);
379
+ --a63-motion-ease-emphasized: cubic-bezier(0.3, 0, 0, 1);
380
+ --a63-motion-ease-overlay: cubic-bezier(0.22, 1, 0.36, 1);
381
+ --a63-motion-ease-scrim: cubic-bezier(0.32, 0.72, 0, 1);
382
+ --a63-motion-skeleton-shimmer-duration: 1500ms;
383
+ }
384
+
385
+ @media (prefers-reduced-motion: reduce) {
386
+ :root {
387
+ --a63-motion-duration-fast: 0ms;
388
+ --a63-motion-duration-overlay: 0ms;
389
+ --a63-motion-duration-swipe-dismiss: 0ms;
390
+ --a63-motion-skeleton-shimmer-duration: 0ms;
391
+ }
132
392
  }
133
393
 
134
394
  @media (pointer: coarse) {
@@ -5,13 +5,18 @@
5
5
  * Skeleton appearance contract.
6
6
  *
7
7
  * Renderers may use different masking primitives, but the base surface and
8
- * highlight emphasis remain shared design semantics.
8
+ * highlight emphasis remain shared design semantics. Each mode block repeats
9
+ * the base alias so a nested light or dark scope resolves it against its own
10
+ * surface roles.
9
11
  */
10
- :root {
12
+ :root,
13
+ .light,
14
+ [data-a63-mode='light'] {
11
15
  --a63-skeleton-base: var(--a63-surface-muted);
12
16
  --a63-skeleton-highlight: var(--color-white-60);
13
17
  }
14
18
 
15
19
  :is(.dark, [data-a63-mode='dark']) {
20
+ --a63-skeleton-base: var(--a63-surface-muted);
16
21
  --a63-skeleton-highlight: var(--color-white-10);
17
22
  }
@@ -1,40 +1,34 @@
1
1
  {
2
2
  "version": "2025.10",
3
- "description": "Skeleton appearance contract.\n\nRenderers may use different masking primitives, but the base surface and\nhighlight emphasis remain shared design semantics.",
4
- "sets": {
5
- "base": {
6
- "sources": [
7
- {
8
- "a63": {
9
- "skeleton": {
10
- "base": {
11
- "$type": "color",
12
- "$value": "{a63.surface.muted}"
13
- },
14
- "highlight": {
15
- "$type": "color",
16
- "$value": "{color.white.60}"
17
- }
18
- }
19
- }
20
- }
21
- ],
22
- "$extensions": {
23
- "io.atom63.css": {
24
- "selector": ":root"
25
- }
26
- }
27
- }
28
- },
3
+ "description": "Skeleton appearance contract.\n\nRenderers may use different masking primitives, but the base surface and\nhighlight emphasis remain shared design semantics. Each mode block repeats\nthe base alias so a nested light or dark scope resolves it against its own\nsurface roles.",
29
4
  "modifiers": {
30
5
  "mode": {
31
6
  "default": "light",
32
7
  "contexts": {
33
- "light": [],
8
+ "light": [
9
+ {
10
+ "a63": {
11
+ "skeleton": {
12
+ "base": {
13
+ "$type": "color",
14
+ "$value": "{a63.surface.muted}"
15
+ },
16
+ "highlight": {
17
+ "$type": "color",
18
+ "$value": "{color.white.60}"
19
+ }
20
+ }
21
+ }
22
+ }
23
+ ],
34
24
  "dark": [
35
25
  {
36
26
  "a63": {
37
27
  "skeleton": {
28
+ "base": {
29
+ "$type": "color",
30
+ "$value": "{a63.surface.muted}"
31
+ },
38
32
  "highlight": {
39
33
  "$type": "color",
40
34
  "$value": "{color.white.10}"
@@ -47,9 +41,6 @@
47
41
  }
48
42
  },
49
43
  "resolutionOrder": [
50
- {
51
- "$ref": "#/sets/base"
52
- },
53
44
  {
54
45
  "$ref": "#/modifiers/mode"
55
46
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Generated from src/contracts/toggle.tokens.json by scripts/build-css-from-dtcg.mjs. Do not edit;
2
+ * Generated from src/contracts/toggle.resolver.json by scripts/build-css-from-dtcg.mjs. Do not edit;
3
3
  * change the DTCG source and run `pnpm --filter @atom63/styles generate:tokens`.
4
4
  *
5
5
  * Toggle contract — persistent on/off controls.
@@ -11,10 +11,13 @@
11
11
  * --a63-toggle-background -> transparent
12
12
  * --a63-toggle-foreground -> var(--a63-text-primary)
13
13
  * --a63-toggle-hover-background -> var(--a63-surface-control-hover)
14
- * --a63-toggle-on-background -> var(--a63-surface-muted)
15
- * --a63-toggle-on-foreground -> var(--a63-text-primary)
16
14
  * --a63-toggle-primary-background -> var(--a63-action-primary)
17
15
  * --a63-toggle-primary-foreground -> var(--a63-action-primary-foreground)
16
+ *
17
+ * The pressed neutral fill is a token, so a theme whose neutral solid sits
18
+ * close to its page (terminal) can give a pressed toggle its own fill. Each
19
+ * mode block repeats it so a nested light or dark scope resolves it against
20
+ * its own action roles.
18
21
  */
19
22
  :root {
20
23
  --a63-toggle-border-width: var(--a63-segment-border-width);
@@ -26,3 +29,15 @@
26
29
  --a63-toggle-text-shadow: none;
27
30
  --a63-toggle-disabled-opacity: 0.56;
28
31
  }
32
+
33
+ :root,
34
+ .light,
35
+ [data-a63-mode='light'] {
36
+ --a63-toggle-on-background: var(--a63-action-neutral);
37
+ --a63-toggle-on-foreground: var(--a63-action-neutral-foreground);
38
+ }
39
+
40
+ :is(.dark, [data-a63-mode='dark']) {
41
+ --a63-toggle-on-background: var(--a63-action-neutral);
42
+ --a63-toggle-on-foreground: var(--a63-action-neutral-foreground);
43
+ }
@@ -0,0 +1,123 @@
1
+ {
2
+ "version": "2025.10",
3
+ "description": "Toggle contract — persistent on/off controls.\n\nCovers standalone Toggle. ToggleGroup is always a joined segmented bar and\nreads the segment contract for cell chrome; it does not use a layout variant.\n\nColour hooks resolve at recipe use-sites:\n --a63-toggle-background -> transparent\n --a63-toggle-foreground -> var(--a63-text-primary)\n --a63-toggle-hover-background -> var(--a63-surface-control-hover)\n --a63-toggle-primary-background -> var(--a63-action-primary)\n --a63-toggle-primary-foreground -> var(--a63-action-primary-foreground)\n\nThe pressed neutral fill is a token, so a theme whose neutral solid sits\nclose to its page (terminal) can give a pressed toggle its own fill. Each\nmode block repeats it so a nested light or dark scope resolves it against\nits own action roles.",
4
+ "sets": {
5
+ "base": {
6
+ "sources": [
7
+ {
8
+ "a63": {
9
+ "toggle": {
10
+ "border": {
11
+ "width": {
12
+ "$type": "dimension",
13
+ "$value": "{a63.segment.border.width}"
14
+ }
15
+ },
16
+ "gap": {
17
+ "$type": "dimension",
18
+ "$value": "{a63.control.gap}"
19
+ },
20
+ "group": {
21
+ "gap": {
22
+ "$type": "dimension",
23
+ "$value": "{a63.segment.gap}"
24
+ }
25
+ },
26
+ "radius": {
27
+ "$type": "dimension",
28
+ "$value": "{a63.control.radius}"
29
+ },
30
+ "shadow": {
31
+ "$root": {
32
+ "$type": "shadow",
33
+ "$value": []
34
+ },
35
+ "active": {
36
+ "$type": "shadow",
37
+ "$value": []
38
+ }
39
+ },
40
+ "text": {
41
+ "shadow": {
42
+ "$type": "shadow",
43
+ "$value": []
44
+ }
45
+ },
46
+ "disabled": {
47
+ "opacity": {
48
+ "$type": "number",
49
+ "$value": 0.56
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ ],
56
+ "$extensions": {
57
+ "io.atom63.css": {
58
+ "selector": ":root"
59
+ }
60
+ }
61
+ }
62
+ },
63
+ "modifiers": {
64
+ "mode": {
65
+ "default": "light",
66
+ "contexts": {
67
+ "light": [
68
+ {
69
+ "a63": {
70
+ "toggle": {
71
+ "on": {
72
+ "background": {
73
+ "$type": "color",
74
+ "$value": "{a63.action.neutral}"
75
+ },
76
+ "foreground": {
77
+ "$type": "color",
78
+ "$value": "{a63.action.neutral.foreground}"
79
+ }
80
+ }
81
+ }
82
+ }
83
+ }
84
+ ],
85
+ "dark": [
86
+ {
87
+ "a63": {
88
+ "toggle": {
89
+ "on": {
90
+ "background": {
91
+ "$type": "color",
92
+ "$value": "{a63.action.neutral}"
93
+ },
94
+ "foreground": {
95
+ "$type": "color",
96
+ "$value": "{a63.action.neutral.foreground}"
97
+ }
98
+ }
99
+ }
100
+ }
101
+ }
102
+ ]
103
+ }
104
+ }
105
+ },
106
+ "resolutionOrder": [
107
+ {
108
+ "$ref": "#/sets/base"
109
+ },
110
+ {
111
+ "$ref": "#/modifiers/mode"
112
+ }
113
+ ],
114
+ "$extensions": {
115
+ "io.atom63.css": {
116
+ "attribute": "data-a63-mode",
117
+ "selectors": {
118
+ "light": ":root,\n.light,\n[data-a63-mode='light']",
119
+ "dark": ":is(.dark, [data-a63-mode='dark'])"
120
+ }
121
+ }
122
+ }
123
+ }
@@ -143,6 +143,9 @@
143
143
  --a63-weather-divider-color: color-mix(in oklch, var(--a63-action-primary) 38%, transparent);
144
144
  --a63-weather-text-shadow: 0 0 10px
145
145
  color-mix(in oklch, var(--a63-action-primary) 22%, transparent);
146
+ /* A pressed toggle is reverse video: phosphor ink fill with page-coloured text. The neutral solid sits too close to the page in both modes. */
147
+ --a63-toggle-on-background: var(--a63-text-primary);
148
+ --a63-toggle-on-foreground: var(--a63-surface-page);
146
149
  }
147
150
 
148
151
  [data-a63-theme='terminal']:is(.dark, [data-a63-mode='dark']),
@@ -177,4 +180,6 @@
177
180
  --a63-weather-muted-foreground: color-mix(in oklch, var(--a63-text-accent) 54%, white 46%);
178
181
  --a63-weather-divider-color: color-mix(in oklch, var(--a63-action-primary) 36%, transparent);
179
182
  --a63-weather-text-shadow: 0 0 8px color-mix(in oklch, var(--a63-action-primary) 38%, transparent);
183
+ --a63-toggle-on-background: var(--a63-text-primary);
184
+ --a63-toggle-on-foreground: var(--a63-surface-page);
180
185
  }
@@ -370,6 +370,19 @@
370
370
  }
371
371
  }
372
372
  }
373
+ },
374
+ "toggle": {
375
+ "on": {
376
+ "background": {
377
+ "$type": "color",
378
+ "$value": "{a63.text.primary}",
379
+ "$description": "A pressed toggle is reverse video: phosphor ink fill with page-coloured text. The neutral solid sits too close to the page in both modes."
380
+ },
381
+ "foreground": {
382
+ "$type": "color",
383
+ "$value": "{a63.surface.page}"
384
+ }
385
+ }
373
386
  }
374
387
  }
375
388
  }
@@ -524,6 +537,18 @@
524
537
  }
525
538
  }
526
539
  }
540
+ },
541
+ "toggle": {
542
+ "on": {
543
+ "background": {
544
+ "$type": "color",
545
+ "$value": "{a63.text.primary}"
546
+ },
547
+ "foreground": {
548
+ "$type": "color",
549
+ "$value": "{a63.surface.page}"
550
+ }
551
+ }
527
552
  }
528
553
  }
529
554
  }
@@ -21,6 +21,16 @@ const textPairs = [
21
21
  { fg: '--a63-text-primary', bg: '--a63-surface-panel', min: AA_TEXT },
22
22
  { fg: '--a63-text-accent', bg: '--a63-surface-page', min: AA_TEXT },
23
23
  { fg: '--a63-text-accent', bg: '--a63-surface-panel', min: AA_TEXT },
24
+ { fg: '--a63-text-danger', bg: '--a63-surface-page', min: AA_TEXT },
25
+ { fg: '--a63-text-danger', bg: '--a63-surface-panel', min: AA_TEXT },
26
+ // Status text (Alert action labels, tinted badges) uses the -subtle-foreground
27
+ // step, not the 3:1 status accent.
28
+ { fg: '--a63-status-info-subtle-foreground', bg: '--a63-surface-page', min: AA_TEXT },
29
+ { fg: '--a63-status-info-subtle-foreground', bg: '--a63-surface-panel', min: AA_TEXT },
30
+ { fg: '--a63-status-success-subtle-foreground', bg: '--a63-surface-page', min: AA_TEXT },
31
+ { fg: '--a63-status-success-subtle-foreground', bg: '--a63-surface-panel', min: AA_TEXT },
32
+ { fg: '--a63-status-warning-subtle-foreground', bg: '--a63-surface-page', min: AA_TEXT },
33
+ { fg: '--a63-status-warning-subtle-foreground', bg: '--a63-surface-panel', min: AA_TEXT },
24
34
  ] as const
25
35
 
26
36
  const actionPairs = [
@@ -28,6 +38,11 @@ const actionPairs = [
28
38
  { fg: '--a63-action-primary-foreground', bg: '--a63-action-primary', min: AA_TEXT },
29
39
  { fg: '--a63-action-neutral-foreground', bg: '--a63-action-neutral', min: AA_UI },
30
40
  { fg: '--a63-action-danger-foreground', bg: '--a63-action-danger', min: AA_UI },
41
+ // A pressed toggle carries its state in its fill (WCAG 1.4.11), so the fill
42
+ // reaches 3:1 against the page and the panel, and its label stays legible.
43
+ { fg: '--a63-toggle-on-background', bg: '--a63-surface-page', min: AA_UI },
44
+ { fg: '--a63-toggle-on-background', bg: '--a63-surface-panel', min: AA_UI },
45
+ { fg: '--a63-toggle-on-foreground', bg: '--a63-toggle-on-background', min: AA_TEXT },
31
46
  // WCAG exempts disabled controls from 4.5:1, but the muted label stays legible.
32
47
  { fg: '--a63-action-disabled-foreground', bg: '--a63-action-disabled-background', min: 2.5 },
33
48
  ] as const
@@ -38,6 +53,7 @@ const statusPairs = [
38
53
  { fg: '--a63-status-info', bg: '--a63-surface-page', min: AA_UI },
39
54
  { fg: '--a63-status-success', bg: '--a63-surface-page', min: AA_UI },
40
55
  { fg: '--a63-status-warning', bg: '--a63-surface-page', min: AA_UI },
56
+ { fg: '--a63-status-danger', bg: '--a63-surface-page', min: AA_UI },
41
57
  ] as const
42
58
 
43
59
  const pairs = [...textPairs, ...actionPairs, ...statusPairs] as const
@@ -102,14 +118,18 @@ function contrastRatio(fg: Rgb, bg: Rgb): number {
102
118
  return (lighter + 0.05) / (darker + 0.05)
103
119
  }
104
120
 
105
- function resolvePaintedColor(cssVar: string, as: 'color' | 'background'): string {
121
+ function resolvePaintedColor(
122
+ cssVar: string,
123
+ as: 'color' | 'background',
124
+ parent: HTMLElement = document.body
125
+ ): string {
106
126
  const probe = document.createElement('div')
107
127
  if (as === 'color') {
108
128
  probe.style.color = `var(${cssVar})`
109
129
  } else {
110
130
  probe.style.backgroundColor = `var(${cssVar})`
111
131
  }
112
- document.body.appendChild(probe)
132
+ parent.appendChild(probe)
113
133
  const style = getComputedStyle(probe)
114
134
  const value = as === 'color' ? style.color : style.backgroundColor
115
135
  probe.remove()
@@ -156,6 +176,36 @@ describe('core semantic contrast (WCAG AA)', () => {
156
176
 
157
177
  expect(failures, failures.join('\n')).toEqual([])
158
178
  })
179
+
180
+ /* A custom property resolves its var() reads on the element that declares it,
181
+ and descendants inherit the result. A UIProvider sets theme and mode on a
182
+ nested element, so a token declared only on :root would keep the root's
183
+ mode there. Resolve every pair inside such a scope, under a light root. */
184
+ it('holds the same pairs inside a nested theme and mode scope', () => {
185
+ const failures: string[] = []
186
+
187
+ for (const theme of themes) {
188
+ for (const mode of modes) {
189
+ const scope = document.createElement('div')
190
+ scope.setAttribute('data-a63-theme', theme)
191
+ scope.setAttribute('data-a63-mode', mode)
192
+ document.body.replaceChildren(scope)
193
+
194
+ for (const { fg, bg, min } of pairs) {
195
+ const fgCss = resolvePaintedColor(fg, 'color', scope)
196
+ const bgCss = resolvePaintedColor(bg, 'background', scope)
197
+ const ratio = contrastRatio(parseCssColor(fgCss), parseCssColor(bgCss))
198
+ if (ratio < min) {
199
+ failures.push(
200
+ `${theme}/${mode} (nested) ${fg} on ${bg}: ${ratio.toFixed(2)}:1 < ${min}:1`
201
+ )
202
+ }
203
+ }
204
+ }
205
+ }
206
+
207
+ expect(failures, failures.join('\n')).toEqual([])
208
+ })
159
209
  })
160
210
 
161
211
  const brands = ['b1', 'b2', 'b3', 'b4', 'b5', 'b6'] as const