@designtools/tokens 0.11.1 → 0.12.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/CHANGELOG.md CHANGED
@@ -2,6 +2,35 @@
2
2
 
3
3
  Notable changes to `@designtools/tokens`. Dates are release dates; versions follow semver, with breaking changes in the minor slot while the package is pre-1.0.
4
4
 
5
+ ## 0.12.0
6
+
7
+ ### Minor Changes
8
+
9
+ - 73d8551: The docs' colour page explains colour, on the project's own tokens: how the layers build (ramps, each colour's roles, the page, grounds), what each name is for on a screen in small, the surfaces as they stack, grounds with their two choices (text, and lines and panels), each colour's palette and the ramps. The step each name points at is measured in the browser, so it follows the mode, a ground and a colour generator re-theming the page. The full colour-on-background matrix is no longer on the page (`PageContrast` is still exported). New blocks: `ColourLayers`, `ColourRoles`, `SurfaceLayers`, `GroundGuide`, `ColourFamilies`.
10
+
11
+ The colour editor has a control for every generator input, set into the page beside what it changes: each ground's step, text and lines (and adding one), the page's colours and the surfaces a project adds, and a panel with the inputs (colours, checks, screens, everyday names, the ramps' shape) set apart from the overrides on top, each with a way back. The studio's CSS writes every token of a ground, so a ground changed in the editor no longer shows the project's own values through.
12
+ - b40fde6: **Grounds, rebuilt simple; page surfaces; aliases opt-in.** 0.11's grounds tripled a plain run (270 lines to 899) and gave this repo's first real project 391 `--on-*` tokens, because every ground was searched twice (against the light page and the dark one), three status banners were grounds by default, and every value was stored per mode.
13
+
14
+ - **A ground is a step on a ramp:** `--color "pine=#133939@800" --decorative pine --ground "pine=pine@800"`. Its ramp is an ordinary colour, so it takes every ramp option. Any ramp can be one (`--ground band=primary@600`).
15
+ - **References only, no modes.** Every value a ground writes is a ramp step, white or black; hover and pressed are steps. A light ground's selector joins the light page's mode block and a dark ground's the dark one's, so everything it doesn't change is already right in either mode, and its own `[data-surface]` scope writes only what differs. No `--on-*` layer.
16
+ - **`--ground-tint` and `--ground-text`**, per ground or for all: `own` (steps on the ground's ramp, searched to their floors), `page` (the page's), or one colour (`white`, `black`, `sage-100`). Defaults `tint own`, `text page`. A button that blends into a ground is searched along its own ramp whatever the tint.
17
+ - **`data-surface="canvas"`** resets to the page in the current mode, with nothing extra generated.
18
+ - **Page surfaces:** `--page-surface "sunken=neutral@100/neutral@900"` adds a page layer beside canvas, surface and overlay, which follows the mode; every page token is searched to work on it.
19
+ - **Breaking:** `--background`, `--surface-<name>`, `--on-*`, status grounds and `--grounds full|text|none` are gone; the CLI refuses `--background` and prints the replacement for each. `green`, `red` and `yellow` need `--aliases`. DTCG carries grounds once, as `ground.<name>.<token>`. The README opens with the concepts and a "Which one do I want?" table.
20
+ - b40fde6: `generate-tokens scale` writes the non-colour scale: space (`--spacing`), size (`--size-*`), type sizes with their line height and tracking as companions, weights, corners, elevation, motion, screen sizes (`--breakpoint-*`) and widths (`--container-*`), as defaults a project retunes with `--overrides` (JSON by token name: a value, a value with its description, or `null`), never by editing the file. Every format: `css` (with screen sizes as `@custom-media` too, since a variable can't go in `@media`), `tailwind-v4` (`@theme static`, plus `:root` for the tiers Tailwind has no namespace for), `tailwind-v3`, `dtcg` and `json`; `--check` compares against the file. Also exported as `defaultScale`, `applyScaleOverrides` and `exportScale`.
21
+ - b40fde6: **No more `muted`: secondary text belongs to its surface, and the quiet panel is the neutral's subdued.** `--muted` and `--muted-foreground` read like a colour grading beside the intents (`success`, `destructive`), and they were two different things under one name.
22
+
23
+ - **`--muted` is gone.** Its job, a quiet neutral panel, is `--neutral-subdued`, the neutral's soft tint, the same model as every other colour's. It keeps muted's rule of sitting a step off the page: 100 under the default canvas, 50 under a white one, 800 in dark. A step set in `shadeOverrides.neutral` still wins.
24
+ - **`--muted-foreground` is each surface's secondary text**: `--canvas-foreground-secondary`, `--surface-foreground-secondary`, `--overlay-foreground-secondary`, and `--<page-surface>-foreground-secondary` for a surface a project adds. Each is searched on its own surface to the text floor (4.5:1, 7:1 at AAA) and stays quieter than that surface's text. `surfaceShadeOverrides` takes a step for each.
25
+ - **Grounds** write `canvas-foreground-secondary` and `surface-foreground-secondary` for the ground and its card. Where nothing quieter than the body text reads (white on a mid-tone card), the secondary text is the body text, and the report says so.
26
+
27
+ To upgrade: `bg-muted` is `bg-neutral-subdued`; `text-muted-foreground` is the secondary text of whatever it sits on, `text-canvas-foreground-secondary` on the page, `text-surface-foreground-secondary` on a card, `text-overlay-foreground-secondary` in a menu.
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [9d76843]
32
+ - @designtools/widgets@0.1.6
33
+
5
34
  ## 0.11.1
6
35
 
7
36
  ### Patch Changes
package/README.md CHANGED
@@ -21,11 +21,51 @@ light mode (wcag, target aa)
21
21
 
22
22
  No config file, no install, no account, no model. Pure arithmetic — the same input always produces byte-identical output. [Why the output holds up](#why-the-output-holds-up) has the detail.
23
23
 
24
+ ## Concepts
25
+
26
+ A handful of words cover everything this package makes. Each is used in one sense only, here, in `--help` and on the docs' colour page.
27
+
28
+ **Ramp.** Twelve steps of one colour, `25` (palest) to `950` (deepest): `--color-primary-25` … `--color-primary-950`. Every colour value in the output lives on a ramp; everything else points at a step.
29
+
30
+ **Step.** One colour on a ramp, named by the ramp and its number: `primary-600`, written `primary@600` where a flag takes a ramp and a step.
31
+
32
+ **Colour.** A ramp you make things in, with semantic tokens: a fill (`--teal`), the label on it (`--teal-foreground`), a soft tint (`--teal-subdued`) and the text on that (`--teal-subdued-foreground`), hover and pressed. `primary`, `neutral`, `success`, `destructive` and `warning` always exist; `--color` adds more. A **decorative** colour (`--decorative`) is a ramp only, with no semantic tokens, for illustration, charts or a ground.
33
+
34
+ **Page tokens.** What a component on the page reads: the colours' tokens, each surface's text and secondary text, `--border`, `--input`, `--ring`, and the page surfaces. They come in a light and a dark set, and follow `data-theme` or the visitor's setting.
35
+
36
+ **Page surface.** A layer of the page, which follows the mode: `canvas` (the page), `surface` (a card), `overlay` (a menu, a dialog), and any more a project adds (`--page-surface`): a sunken well, a raised panel, an alternate section. Every page token is searched to work on every page surface, so nothing on one needs a scope.
37
+
38
+ **Ground.** A section painted one step of a ramp, the same colour in light and dark mode: a deep green band, a lime page. The page's tokens may not work on it, so it gets its own, inside `data-surface="<name>"`. See [Grounds](#grounds).
39
+
40
+ **Mode.** Light or dark. Page tokens and page surfaces change with it; ramps and grounds don't.
41
+
42
+ **Polarity.** Whether a background reads as light (it takes dark text) or dark (light text). A ground's polarity says which of the page's two sets of tokens it starts from; a page surface of the other polarity from its page is really a ground.
43
+
44
+ **Foreground.** The text or label that reads on the thing it's named after: `--primary-foreground` on `--primary`, `--canvas-foreground` on the page. Always measured against what it sits on, never a fixed step.
45
+
46
+ Two pairs of words look alike and aren't:
47
+
48
+ - **Secondary text belongs to the surface it sits on**: `--canvas-foreground-secondary` for a caption on the page, `--surface-foreground-secondary` on a card, `--overlay-foreground-secondary` in a menu, each quieter than that surface's text and searched to read on it. It's a level of text, not a colour, so it isn't a pair. **`-subdued`** is a colour's own soft tint: `--success-subdued` behind a "Paid" badge, `--destructive-subdued` behind an error banner, `--neutral-subdued` for a quiet panel (a code block, a track), each with its `-subdued-foreground`.
49
+ - **`--surface`** is the page's card. A **page surface** is any of the page's layers, the card among them. A **ground** is not a page surface: a page surface follows the mode, a ground doesn't.
50
+
51
+ ## Which one do I want?
52
+
53
+ | I want… | Use |
54
+ | --- | --- |
55
+ | a button, badge or link colour | `--color` |
56
+ | a palette only, never text or an action (an illustration colour, a chart series) | `--color` + `--decorative` |
57
+ | a card, a menu, a sunken well, an alternate section that goes dark in dark mode | a page surface: `canvas`, `surface`, `overlay`, or `--page-surface` |
58
+ | a section painted a brand colour, the same in both modes | a ground: `--ground` |
59
+ | a success, warning or error banner | the page's `-subdued` tokens (`bg-success-subdued text-success-subdued-foreground`); no ground |
60
+ | white lines, edges and focus ring on a dark band, text as usual | a ground with `--ground-tint white` (text on a dark ground is white anyway) |
61
+ | lines and panels in a band's own hue, text in the page's | a ground, as it comes (`tint own`, `text page`) |
62
+ | a card inside a band that reads as the page again | `data-surface="canvas"` on the card |
63
+
24
64
  ## What it generates
25
65
 
26
66
  From a single seed colour:
27
67
 
28
- **Colour ramps** — a twelve-step OKLCH scale (`25, 50, 100 … 900, 950`) for each colour. `primary` and `neutral` come from your seeds; `success`/`green`, `destructive`/`red` and `warning`/`yellow` are derived from the primary so they sit in the same colour world rather than clashing with it.
68
+ **Colour ramps** — a twelve-step OKLCH scale (`25, 50, 100 … 900, 950`) for each colour. `primary` and `neutral` come from your seeds; `success`, `destructive` and `warning` are derived from the primary so they sit in the same colour world rather than clashing with it. `--aliases` adds `green`, `red` and `yellow` as second names for those three ramps.
29
69
 
30
70
  ```css
31
71
  --color-primary-25: oklch(97.34% 0.0065 215.79);
@@ -33,7 +73,7 @@ From a single seed colour:
33
73
  --color-primary-950: oklch(17.50% 0.0766 215.79);
34
74
  ```
35
75
 
36
- **Semantic intents** — what you actually write in components. Each of `primary`, `neutral`, `success`, `destructive`, `warning` gets a fill and a subdued tint, each with its label, plus a `muted` pair:
76
+ **Semantic intents** — what you actually write in components. Each of `primary`, `neutral`, `success`, `destructive`, `warning` gets a fill and a subdued tint, each with its label:
37
77
 
38
78
  ```css
39
79
  --primary --primary-foreground
@@ -42,13 +82,13 @@ From a single seed colour:
42
82
 
43
83
  Every `-foreground` is chosen by rule and measured, not a fixed mapping (see [Foregrounds](#foregrounds-are-chosen-by-what-they-sit-on)). Hover and press are `--primary-hover` and `--primary-active` (see below). `highlight`, which sat two steps from the fill and read as pressed rather than hover, was removed in 0.7.0.
44
84
 
45
- **Surfaces and utilities** — `--canvas`, `--surface`, `--overlay` with paired foregrounds, plus `--border`, `--input`, `--ring`, `--shadow`. The three backgrounds default to neutral steps and take exact colours per mode (`--canvas "#F2F2F0/#12171D"`); a brand's other section backgrounds come in by name (`--background stone=#E8E8DB`) as `--surface-stone` with measured text, and as a [ground](#grounds-content-on-coloured-backgrounds).
85
+ **Page surfaces and utilities** — `--canvas`, `--surface`, `--overlay` with paired foregrounds, any [page surfaces](#page-surfaces) a project adds, plus `--border`, `--input`, `--ring`, `--shadow`. The three default to neutral steps and take exact colours per mode (`--canvas "#F2F2F0/#12171D"`). A section painted a colour of its own is a [ground](#grounds).
46
86
 
47
87
  **Hover and press are generated.** Each fill gets `--<name>-hover` and `--<name>-active`: the fill moved 0.09 and 0.15 in lightness away from its label (darker under a white label, lighter under a black one), so the change is plain to see and the label reads better on it, never worse. The 90% opacity they replace was barely visible (median ΔE 4.7) and dropped 26 of 90 labels under 4.5:1 by letting the page show through.
48
88
 
49
89
  **Status text on the page is the subdued label.** `--success-subdued-foreground` and its siblings are guaranteed to read as text on every background of their mode, so an error message is `text-destructive-subdued-foreground`, not `text-destructive` (the fill, measured only against its own label). A warning on the page is neutral text with an icon: warning is an orange, and orange dark enough to be text reads as brown. In light mode warning, and any yellow or orange brand colour, carries its hue in a stronger tint (step 200) with a near-black label for the same reason.
50
90
 
51
- **Every colour against every background.** A label is checked on its own fill; `pageContrast` (and `--report`) measures the rest: each semantic fill and muted text against the canvas, surface, overlay and each named background, per mode, so red text on a dark page (2.4:1 for every brand tested) or a deep purple button on a dark canvas (1.2:1) shows up before it ships. Read it as text (4.5:1 at AA) or as a shape (3:1, WCAG 1.4.11): a button's own label makes its outline optional, a meter fill or a switch has no label to lean on. This measures the page's tokens where they land; inside `data-surface` a [ground](#grounds-content-on-coloured-backgrounds) gives content tokens chosen for that background instead.
91
+ **Every colour against every background.** A label is checked on its own fill; `pageContrast` (and `--report`) measures the rest: each semantic fill and each surface's secondary text against the canvas, surface, overlay, each page surface and each ground, per mode, so red text on a dark page (2.4:1 for every brand tested) or a deep purple button on a dark canvas (1.2:1) shows up before it ships. Read it as text (4.5:1 at AA) or as a shape (3:1, WCAG 1.4.11): a button's own label makes its outline optional, a meter fill or a switch has no label to lean on. This measures the page's tokens where they land; inside `data-surface` a [ground](#grounds) gives content tokens chosen for that background instead.
52
92
 
53
93
  **Light and dark**, derived independently from the same ramps rather than one being a transform of the other, with contrast re-checked per mode. Output is keyed on `[data-theme]` with a `prefers-color-scheme` fallback, so it works with or without a theme toggle:
54
94
 
@@ -59,92 +99,116 @@ Every `-foreground` is chosen by rule and measured, not a fixed mapping (see [Fo
59
99
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { … } }
60
100
  ```
61
101
 
62
- ## Adding colours: three flags, three jobs
102
+ ## Every name, and what it's for
63
103
 
64
- Beyond the primary and the neutral, a colour comes in one of three ways. They do different jobs; pick by what the colour is for, not by what it looks like.
104
+ | Name | What it's for |
105
+ | --- | --- |
106
+ | `--color-<ramp>-<step>` | A step on a ramp. The only colour values; everything below points at one |
107
+ | `--color-white`, `--color-black` | White and black |
108
+ | `--<colour>` | A colour's fill: a button, a badge |
109
+ | `--<colour>-foreground` | The label on that fill |
110
+ | `--<colour>-subdued` | The colour's soft tint: behind a badge or a banner |
111
+ | `--<colour>-subdued-foreground` | Text on the tint, and the colour's own text on the page (an error under a field) |
112
+ | `--<colour>-hover`, `--<colour>-active` | The fill hovered and pressed |
113
+ | `--canvas`, `--canvas-foreground` | The page and its text |
114
+ | `--canvas-foreground-secondary` | Secondary text on the page: captions, dates, hints |
115
+ | `--surface`, `--surface-foreground`, `--surface-foreground-secondary` | A card, its text and its secondary text |
116
+ | `--overlay`, `--overlay-foreground`, `--overlay-foreground-secondary` | A menu or dialog, its text and its secondary text |
117
+ | `--<page-surface>`, `-foreground`, `-foreground-secondary` | A page surface a project added, its text and its secondary text |
118
+ | `--border` | A divider or a card's edge: decoration |
119
+ | `--input` | An input's edge: a control, 3:1 against the page |
120
+ | `--ring` | The focus ring: 3:1 against the page |
121
+ | `--shadow` | The shadow colour |
122
+
123
+ Inside `data-surface="<ground>"` the same names hold that ground's values; there are no other names. `data-surface="canvas"` resets to the page.
124
+
125
+ ## Adding colours
126
+
127
+ Beyond the primary and the neutral, a colour comes in one of two ways. Pick by what it is for, not by what it looks like.
65
128
 
66
129
  | You have | Flag | You get | Use it for |
67
130
  |---|---|---|---|
68
131
  | A colour things are made **in**: a second brand colour, a category colour | `--color teal=#14b8a6` | A ramp (`--color-teal-25` … `-950`) **and** semantic tokens: `--teal`, `-foreground`, `-subdued`, `-subdued-foreground`, `-hover`, `-active`, each label contrast-checked | Buttons, badges, tags, text in that colour |
69
- | A colour that must **never** be text or an action: an illustration tint, a chart accent | `--color sand=#e8d5b0 --decorative sand` | The ramp only. No `--sand`, no `bg-sand`, so it cannot end up as a label or a button by accident | Decoration, data viz, artwork |
70
- | A colour a whole **section** is painted with: a band on a marketing page | `--background brand=#4f46e5` | One exact colour, `--surface-brand`, with measured text, **and a ground**: inside `data-surface="brand"` every token is searched again against it ([below](#grounds-content-on-coloured-backgrounds)) | Page sections, hero bands, footers |
71
-
72
- `--background` takes the colour exactly as given and makes no ramp from it; if you also want a scale in that colour, add it with `--color` as well. A background name can't be one a token or ground already uses (`canvas`, `surface`, `primary`, `warning-subdued`, …): each one becomes a `data-surface` value and a token prefix, so a clash would put two things under one name. The generator refuses it and says which names are taken.
132
+ | A colour that must **never** be text or an action: an illustration tint, a chart accent, a band's colour | `--color sand=#e8d5b0 --decorative sand` | The ramp only. No `--sand`, no `bg-sand`, so it cannot end up as a label or a button by accident | Decoration, data viz, artwork, [grounds](#grounds) |
73
133
 
74
- ## Grounds: content on coloured backgrounds
134
+ Any colour takes every ramp option: where its own colour lands (`teal=#14b8a6@600`), and, by name in a seed's `families`, its own chroma, tint floor, hue drift and lightness range, and pins. A section's colour is shaped the same way, because a section's colour is a ramp: see [Grounds](#grounds).
75
135
 
76
- The page tokens are searched against the canvas, the surface and the overlay. Content sits on other backgrounds too: a warning banner with a button in it, an indigo band on a marketing page with a caption and a call to action. On those, the page's tokens were only ever measured, never chosen, and a primary button on a primary band is 1:1.
136
+ ## Page surfaces
77
137
 
78
- A **ground** is a background content sits on, with every token content needs on it searched again against that background. Mark the element once and components inside need no change:
79
-
80
- ```html
81
- <section data-surface="brand">
82
- <h2>Book your first session</h2>
83
- <p class="text-muted-foreground">Readable on the band, quieter than the heading</p>
84
- <button class="bg-primary text-primary-foreground">Get started</button> <!-- turns white, label indigo -->
85
- <div class="bg-surface" data-surface="surface">A card resets to the page's own tokens</div>
86
- </section>
138
+ The page has three surfaces: `canvas`, `surface` and `overlay`. An app or a site often needs more: a sunken well behind a list, a raised panel, an alternate section that separates two others. They belong to the page, so they change with the mode:
87
139
 
88
- <div data-surface="success-subdued">A banner: <button class="bg-primary …">this button is green here</button></div>
140
+ ```
141
+ --page-surface "sunken=neutral@100/neutral@900"
142
+ --page-surface "alt=neutral@50"
89
143
  ```
90
144
 
91
- **Which grounds there are**
145
+ Each is a step for light and one for dark, after a slash; without a dark one it takes the light step's mirror on the same ramp (`50` to `900`, `100` to `800`, `400` to `500`). A colour works too, as `--canvas` takes one: `--page-surface "alt=#F2F2F0/#1A2028"`. It's emitted in the mode blocks as `--sunken` and `--sunken-foreground` (measured text), with `bg-sunken` and `text-sunken-foreground` in Tailwind.
92
146
 
93
- | Ground | From | Its tokens |
94
- |---|---|---|
95
- | `canvas`, `surface` | Always | The page's own, exactly. Use them to reset inside another ground: a card in a band is `data-surface="surface"` |
96
- | `success-subdued`, `warning-subdued`, `destructive-subdued` | Always | Searched against the status tint: banners, alerts, inline messages |
97
- | `<name>` | Each `--background <name>=…` | Searched against that colour |
147
+ **Every page token is searched to work on every page surface** of the page's polarity, as on canvas and surface: the ring and an input's edge to 3:1, its own secondary text to 4.5:1, status text to the text floor. So nothing on a page surface needs a scope. A page surface of the other polarity (a dark band on a light page) is measured but not searched for: it reads as a ground, so make it one. A name can't be a colour's or a page token's (`primary`, `border`…); the generator says which names are taken.
98
148
 
99
- **What each ground carries.** The same names everywhere, so a component reads the same tokens on any ground:
149
+ ## Grounds
100
150
 
101
- | Token inside the ground | For | Must reach |
102
- |---|---|---|
103
- | `--canvas`, `--canvas-foreground` | The ground and its body text | the ground's own text (a status tint's label, a band's measured text) |
104
- | `--muted`, `--muted-foreground` | Panels, captions, supporting copy | text at 4.5:1 (7:1 at AAA) on the ground and on a muted panel, and quieter than the body text |
105
- | `--border` | Dividers | the separation the border has on the page |
106
- | `--input`, `--ring` | A field's edge, the focus ring | 3:1 (WCAG 1.4.11) |
107
- | `--<colour>`, `-foreground`, `-hover`, `-active` | Buttons, for every semantic colour | the fill stands out from the ground at 3:1; its label reads on it |
108
- | `--<colour>-subdued`, `-subdued-foreground` | Chips, and that colour's text on the ground (an error under a field) | the label reads on the tint and on the ground |
151
+ A **ground** is a section painted one step of a ramp: a deep green band, a lime page, a brand-colour stripe. It is the same colour in light and dark mode, as a painted section is. The page's tokens may not work on it: a primary button on a primary band is 1:1, a caption on a dark band unreadable. So inside `data-surface="<name>"` content reads tokens chosen for the ground, through the everyday names, and components need no change:
109
152
 
110
- **The rule: everything takes the ground's colour, except what carries a meaning.** On a coloured ground (a status tint, or a band with real colour) the primary button, the focus ring, chips, links, panels, borders, input edges and secondary text all come from the ground's own ramp, and the neutral button becomes a tonal one in that hue: in a success banner the button and ring are green, on an indigo band indigo. Status colours keep their meaning, so a delete button is still red in a success banner. Each value is the ground's page token where that reads on the ground (a success banner's button is `--success`), and searched along the ramp where it doesn't. On its own colour a button turns over: on the brand band the primary button is the ramp's palest step with the brand colour in its label. A neutral ground (the canvas, the surface, a stone or near-grey band) keeps the page's tokens wherever they work.
153
+ ```
154
+ --color "pine=#133939@800" --decorative pine
155
+ --ground "pine=pine@800"
156
+ ```
111
157
 
112
- **What it can't do, it says.** `--report` lists what each ground changed from the page and anything its search couldn't reach. Two you will see:
158
+ ```html
159
+ <section data-surface="pine">
160
+ <h2>Book your first session</h2>
161
+ <p class="text-canvas-foreground-secondary">Readable on the band, quieter than the heading</p>
162
+ <button class="bg-primary text-primary-foreground">Get started</button>
163
+ <div class="bg-surface" data-surface="canvas">A card that reads as the page again</div>
164
+ </section>
165
+ ```
113
166
 
114
- - On a light success or destructive banner the body text is already the tint's label at about 6:1, so no quieter step still reads at 4.5:1, and the muted text is the body colour.
115
- - On a saturated band, status text has to be near white to read, so red text on an indigo band is a very pale red. Let the icon carry the meaning.
167
+ **A ground is a step on a ramp,** and its ramp is an ordinary colour, so it takes every ramp option above: its own anchor, chroma, tint floor, hue drift, pins. Any ramp can be one: `--ground "band=primary@600"` paints a band in the brand colour. `--decorative` isn't required, only usual: it keeps a section's colour from also being a button colour (`bg-pine`). To see what text and lines a step will get before choosing it, run `--report`.
116
168
 
117
- **Not part of a ground:** `--surface`, `--overlay` and their foregrounds (a card is still a card, on any band), `--shadow`, and the ramps.
169
+ **Every value in a ground is a reference** to a step, or to white or black. Hover and pressed are steps along the fill's ramp. There is no computed colour, and no light or dark version: one ground, one set of references.
118
170
 
119
- **How it's emitted.** Each ground's tokens sit in the mode blocks as `--on-<ground>-<token>` (`--on-brand-primary`, `--on-warning-subdued-muted-foreground`), only where they differ from the page; the rest read the page's copy, `--on-canvas-<token>`. After the mode blocks, one scope per ground re-points the everyday names and paints the ground:
171
+ **It writes only what differs.** A light ground's selector is on the light page's mode block and a dark ground's on the dark one's, so inside a ground everything is already the page's token of the ground's polarity, whatever the page's mode. The ground's own scope then writes what it changes, and paints itself:
120
172
 
121
173
  ```css
122
- [data-surface="brand"] {
123
- --primary: var(--on-brand-primary);
124
- --muted-foreground: var(--on-brand-muted-foreground);
125
- /* … every token the ground carries … */
174
+ [data-surface="pine"] {
175
+ --canvas: var(--color-pine-800);
176
+ --border: var(--color-white);
177
+ --ring: var(--color-white);
178
+ --primary: var(--color-primary-600);
179
+ /* … only what differs … */
126
180
  background-color: var(--canvas);
127
181
  color: var(--canvas-foreground);
128
182
  }
129
183
  ```
130
184
 
131
- Because the values live in the mode blocks, a ground follows `data-theme` and `prefers-color-scheme` like everything else, and a ground nested in another (a banner inside a band) reads its own values, not its parent's. The `tailwind-v4` format re-binds each `--color-*` alias inside the scope too, for [the reason the mode blocks do](#tailwind-v4), so `bg-primary` follows the ground.
185
+ **Two choices per ground say where its tokens come from**, one for its text and one for everything else, its tint:
132
186
 
133
- **Changing one token on one ground** is ordinary CSS after the generated file, unlayered (see [Overriding](#overriding-what-it-generates)). It applies in both modes, because the scope reads the mode's value:
187
+ | Value | Text (`--ground-text`: body and secondary text) | Tint (`--ground-tint`: lines, panels, card, input, ring, buttons) |
188
+ | --- | --- | --- |
189
+ | `page` | the page's text wherever it reads on the ground; white or black where it doesn't. Muted text the page's, or the neutral's nearest that reads | the page's own lines, panels, input and ring |
190
+ | `own` | steps from the ground's ramp, searched to the text floors | steps from the ground's ramp, each searched to its floor: a deeper green line on green |
191
+ | one colour: `white`, `black`, or a step (`sage-100`) | that colour for body and secondary text both (the report says secondary text is then no quieter) | as `own`, with that colour for every line, edge and ring: white lines on deep green, its panels and card still green |
134
192
 
135
- ```css
136
- [data-surface="brand"] { --neutral: transparent; --neutral-foreground: var(--color-white); }
137
- ```
193
+ Defaults: `text page`, `tint own`. So text is one standard set across a site, and lines and panels take each ground's hue. A bare value sets every ground; `<name>=<value>` sets one and wins: `--ground-tint own --ground-tint pine=white`. In a seed: `"grounds": { "pine": { "ramp": "pine", "step": 800, "tint": "white" } }`, `"groundTint"`, `"groundText"`.
138
194
 
139
- **How much a ground carries: `--grounds`.**
195
+ **Buttons and other colours keep the page's value unless it fails.** The primary and secondary buttons, accent, success, error and warning are the page's wherever they stand out from the ground (3:1 for a fill, with a label that reads on it). One that doesn't is searched along its own ramp: a navy button on deep green moves to a step that shows. Under `tint own` (and one colour) the primary button is drawn from the ground's ramp (on its own colour it turns over: the deepest step with the ground's colour in its label), and the secondary button is tonal: a tint of the ground's hue whose label carries it.
140
196
 
141
- | `--grounds` | Inside `data-surface` | Default CSS file |
142
- |---|---|---|
143
- | `full` *(default)* | Every token above, tinted to the ground and contrast-checked on it | about 900 lines, plus about 150 per `--background` |
144
- | `text` | The background and its text only; buttons, borders, the ring and the rest stay the page's | about 330 lines |
145
- | `none` | No grounds: no `data-surface`, no `--on-*`. Each `--background` is `--surface-<name>` and its text, painted with classes | about 270 lines, as before grounds |
197
+ **Resetting inside a ground.** `data-surface="canvas"` on a card or a nested section gives it the page's tokens as they are in the current mode, with nothing extra generated: the page's mode blocks match it.
146
198
 
147
- With `text`, the page's tokens are not checked against the ground: a blue button in a dark green banner can fall under 3:1, and `--report` still measures it. To keep `full` but put one token back to the page's, read the page's copy: `[data-surface="success-subdued"] { --primary: var(--on-canvas-primary); }`.
199
+ **Banners aren't grounds.** A success, warning or error banner is the page's `-subdued` pair. Its text always reads (it is measured on the page), and `--report` lists where a filled button blends into a tint, so the banner can use the outline button there.
200
+
201
+ `--report` lists each ground's ramp, step, polarity, text and tint, and everything it writes with the step and its ratio, then anything that couldn't reach its floor:
202
+
203
+ ```
204
+ grounds: what data-surface="<ground>" writes (ratio against the ground; a label's against its fill)
205
+ pine pine@800, dark, text page, tint white
206
+ border white 12.6, input white 12.6, ring white 12.6, primary primary-600 3.6, …
207
+ mist mist@200, light, text page, tint own
208
+ canvas-foreground-secondary neutral-800 9.3, border mist-300 1.6, input mist-600 4.0, neutral-subdued mist-300 1.6, …
209
+ ```
210
+
211
+ A background that should change with the mode isn't a ground: it is a [page surface](#page-surfaces).
148
212
 
149
213
  ## Try it
150
214
 
@@ -250,6 +314,37 @@ check: tokens.css differs — same generator and seed, so the file was edited by
250
314
  check: tokens.css differs — generated by v0.4.0, running v0.5.0. Expected after a generator upgrade.
251
315
  ```
252
316
 
317
+ ## The scale: everything that isn't colour
318
+
319
+ Colour comes from a seed; the rest of a system has none, so `generate-tokens scale` writes a set of defaults, in the same formats, for a project to retune with overrides:
320
+
321
+ ```bash
322
+ npx @designtools/tokens scale --format tailwind-v4 --overrides scale.overrides.json --out app/styles/scale.css
323
+ npx @designtools/tokens scale --format css --out src/styles/scale.css
324
+ npx @designtools/tokens scale --format all --out ./tokens # css, tailwind-v3, dtcg, json
325
+ ```
326
+
327
+ | Tier | Tokens | What it is |
328
+ | --- | --- | --- |
329
+ | Space | `--spacing` | The gap between things: one 4px multiplier, so every space is a whole number of it |
330
+ | Size | `--size-xs` … `--size-3xl` | The extent of a thing: icons, avatars, control heights |
331
+ | Type | `--text-xs` … `--text-4xl`, `--leading-*`, `--tracking-*`, `--font-weight-*` | Each size carries its line height and tracking (`--text-sm--line-height`), so the pair is never set apart |
332
+ | Corners | `--radius-xs` … `--radius-full` | Scaled to the element |
333
+ | Elevation | `--shadow-xs` … `--shadow-xl` | A contact and an ambient shadow, over the `--shadow` colour |
334
+ | Motion | `--duration-*`, `--ease-*` | How long a change takes and how it moves |
335
+ | Screen sizes | `--breakpoint-sm` … `--breakpoint-2xl` | Where a page can change shape, from each size up |
336
+ | Widths | `--container-3xs` … `--container-7xl` | The widths content is set to |
337
+
338
+ The names are the contract and the values are art direction: override values, keep the names. The names are Tailwind v4's theme namespaces, so on Tailwind each is a utility as well, and on any other stack a plain custom property. Screen sizes are the one tier a variable can't carry, since CSS can't read one in `@media`: `--format css` writes them as `@custom-media` too (compiled by Lightning CSS or postcss-preset-env), and DTCG, JSON and Tailwind v3 carry them as values. A page's grid is composed from these, widths, screen sizes and space, rather than named as tokens of its own.
339
+
340
+ `--overrides` is JSON by token name: a value, a value with its description, or `null` to remove one. A new name joins the tier its prefix belongs to, and a name in no tier is an error.
341
+
342
+ ```json
343
+ { "--radius-md": "0.5rem", "--text-5xl": { "value": "3rem", "description": "48px: page titles" }, "--text-5xl--line-height": "var(--leading-none)", "--leading-relaxed": null }
344
+ ```
345
+
346
+ `--check` compares against the file at `--out` and exits 1 when it differs, as the colour does.
347
+
253
348
  ## Trying scales live: the studio
254
349
 
255
350
  Once the tokens exist, `@designtools/tokens/studio` lets you try the hand-authored scales on the running app before writing them: a type ramp from a base and a ratio, the spacing unit, radii and shadows. It draws in the [`@designtools/widgets`](../widgets) dock, on the page you put it on, and changes the page and every [artboard](../artboards) as you go. It never writes a file: Copy prompt hands the changes back for `scale.css`.
@@ -329,7 +424,7 @@ generate-tokens --primary "#4e9caf" --color accent=#8b5cf6 \
329
424
  --ramps accent --out tokens.css --merge
330
425
  ```
331
426
 
332
- A family-scoped run leaves surfaces, utilities and [grounds](#grounds-content-on-coloured-backgrounds) alone: they read every family, so no one colour owns them. After regenerating a family a ground draws on, refresh the grounds the same way:
427
+ A family-scoped run leaves surfaces, utilities and [grounds](#grounds) alone: they read every family, so no one colour owns them. After regenerating a family a ground draws on, refresh the grounds the same way:
333
428
 
334
429
  ```bash
335
430
  generate-tokens --primary "#4e9caf" --color destructive=#ff0000 \
@@ -369,7 +464,26 @@ So an agent's contract is *scope, merge, verify* — and a bad merge is caught r
369
464
 
370
465
  ### Aliases move together
371
466
 
372
- `destructive`/`red`, `success`/`green` and `warning`/`yellow` are two names for one scale, so overriding either moves both. Without that, `--color destructive=…` would leave `bg-red-500` on the old colour and the two names would silently disagree inside the same file.
467
+ With `--aliases`, `destructive`/`red`, `success`/`green` and `warning`/`yellow` are two names for one scale, so overriding either moves both. Without that, `--color destructive=…` would leave `bg-red-500` on the old colour and the two names would silently disagree inside the same file.
468
+
469
+ ## Upgrading to 0.12
470
+
471
+ Grounds are rebuilt simple, and aliases are opt-in. A plain run (`--primary` alone, CSS) is 234 lines, from 899 in 0.11 and 270 before it.
472
+
473
+ | 0.11 | 0.12 |
474
+ | --- | --- |
475
+ | `--background stone=#E8E8DB` (one colour) | `--color "stone=#E8E8DB@<step>" --decorative stone --ground "stone=stone@<step>"`: a ground on a ramp |
476
+ | `--background mist=#F2F2F0/#1A2028` (a colour per mode) | `--page-surface "mist=#F2F2F0/#1A2028"`: it follows the mode, so it's a page surface |
477
+ | `--surface-<name>`, `bg-surface-<name>` | a ground: `data-surface="<name>"` (`--canvas` inside it); a page surface: `--<name>`, `bg-<name>` |
478
+ | `--on-<ground>-*` | gone: a ground writes its values straight into its scope |
479
+ | `success-subdued`, `warning-subdued`, `destructive-subdued` as `data-surface` values | gone: a banner is `bg-success-subdued text-success-subdued-foreground` |
480
+ | `--grounds full \| text \| none` | gone. A project has grounds only where it declares them; `text` is `--ground-tint page` |
481
+ | `--ground-tint borrow \| own \| neutral` on a background | `--ground-tint own \| page \| <colour>` on a ground |
482
+ | `green`, `red`, `yellow` ramps | `--aliases` |
483
+ | `--muted`, `bg-muted` (a quiet panel) | `--neutral-subdued`, `bg-neutral-subdued`: the neutral's quiet tint, kept a step off the page as muted was |
484
+ | `--muted-foreground`, `text-muted-foreground` (quiet text) | the secondary text of the surface it sits on: `text-canvas-foreground-secondary` on the page, `text-surface-foreground-secondary` on a card, `text-overlay-foreground-secondary` in a menu |
485
+
486
+ The CLI refuses `--background` and prints the replacement for each, with the step its lightness suggests: rerun with that, then `pnpm tokens`. A seed's `backgrounds` and a string `grounds` are refused the same way.
373
487
 
374
488
  ## Upgrading to 0.6.0
375
489
 
@@ -422,7 +536,7 @@ With `gamut: "p3"`, the wide-gamut tiers are on `tokens.p3`, and the checks take
422
536
  | `css` *(default)* | `tokens.css` | CSS custom properties. The lead format — works in any project. Mode blocks carry both `[data-theme]` attributes and `.dark`/`.light` classes, matching `tailwind-v4`. |
423
537
  | `tailwind-v4` | `tailwind.css` | A complete `@theme static` block. See [Tailwind v4](#tailwind-v4). |
424
538
  | `tailwind-v3` | `tailwind.config.js` | `theme.extend.colors` config. |
425
- | `dtcg` | `tokens.dtcg.json` | W3C Design Token Community Group JSON. Grounds sit under each mode as `light.ground.<name>.<token>`. |
539
+ | `dtcg` | `tokens.dtcg.json` | W3C Design Token Community Group JSON. Grounds sit once, outside the modes, as `ground.<name>.<token>`. |
426
540
  | `json` | `tokens.json` | The raw `TokenSystem`, for downstream tooling. |
427
541
 
428
542
  `--color-format` controls how literal values are printed: `oklch` (default), `hex`, `rgb`, `hsl`.
@@ -437,7 +551,7 @@ With `gamut: "p3"`, the wide-gamut tiers are on `tokens.p3`, and the checks take
437
551
  |---|---|---|
438
552
  | `--primary <colour>` | — | Your brand colour. Required unless `--seed` supplies it. |
439
553
  | `--neutral <colour>` | `#747474` | Neutral seed. Drives greys, surfaces, borders. |
440
- | `--color <name>=<colour>[@<shade>]` | — | An extra named colour: a ramp and semantic tokens. Repeatable. `@<shade>` anchors its seed on that step. See [Adding colours](#adding-colours-three-flags-three-jobs). |
554
+ | `--color <name>=<colour>[@<shade>]` | — | An extra named colour: a ramp and semantic tokens. Repeatable. `@<shade>` anchors its seed on that step. See [Adding colours](#adding-colours). |
441
555
  | `--decorative <name>` | — | Give an added colour its ramp only, with no semantic slots (`--<name>`, `-foreground`, `bg-<name>`), so an accent that must never be text or an action cannot be used as one. Repeatable. In a seed file, `"decorative": true` on the colour. |
442
556
  | `--seed <file.json>` | — | Replay a saved configuration. Flags given alongside it win, so a seed is defaults rather than a lock. |
443
557
  | `--stdin` | off | Read that same JSON from standard input. |
@@ -471,9 +585,11 @@ A seed file:
471
585
  | `--foreground` | `balanced` · `max` | `balanced` | Labels on a fill: white or black, or a tint keeping 90% of that (`balanced`); never a tint (`max`). |
472
586
  | `--no-wcag-floor` | — | — | With `--contrast apca`, choose by APCA alone, without holding pairings to the WCAG 2 floor. |
473
587
  | `--canvas`, `--surface`, `--overlay` | `<colour>[/<dark>]` | neutral steps | The page, card and overlay as exact colours, light then dark; text on each is measured. |
474
- | `--grounds` | `full` · `text` · `none` | `full` | What `data-surface` gives each [ground](#grounds-content-on-coloured-backgrounds): every token tinted to it, its background and text only, or no grounds. |
475
- | `--background` | `<name>=<colour>[/<dark>]` | — | A colour a section is painted with, emitted as `--surface-<name>` with measured text and as a [ground](#grounds-content-on-coloured-backgrounds): inside `data-surface="<name>"` every token is searched again against it. Repeatable. Names a token or ground uses are refused. Not a ramp: use `--color` for that. |
476
- | `--usage <file.json>` | — | — | Also write where each colour can go: every fill, status text tone and muted text on every background, per mode, as text, shape or neither (`designtools.usage/1`). `@designtools/manifest` turns the failures into measured usage rules. `--check` compares it too. |
588
+ | `--page-surface` | `<name>=<ramp>@<step>[/<ramp>@<step>]`, or colours | — | Another [page surface](#page-surfaces) beside canvas, surface and overlay, which follows the mode. Dark defaults to the light step's mirror. Repeatable. |
589
+ | `--ground` | `<name>=<ramp>@<step>` | — | A [ground](#grounds): a section painted that step, the same in both modes, with tokens that work on it inside `data-surface="<name>"`. Repeatable. |
590
+ | `--ground-tint` | `own` · `page` · `white` · `black` · `<ramp>-<step>`, or `<name>=<value>` | `own` | Where a ground's lines, panels, card, input, ring and buttons come from. Repeatable; a named value wins. |
591
+ | `--ground-text` | as `--ground-tint` | `page` | Where a ground's body and secondary text come from. Repeatable; a named value wins. |
592
+ | `--usage <file.json>` | — | — | Also write where each colour can go: every fill, status text tone and secondary text on every background, per mode, as text, shape or neither (`designtools.usage/1`). `@designtools/manifest` turns the failures into measured usage rules. `--check` compares it too. |
477
593
  | `--seed-shade` | `25`…`950` | `500` | Which step your primary lands on. |
478
594
  | `--neutral-seed-shade` | `25`…`950` | `500` | Which step your neutral lands on. |
479
595
  | `--light-end` | `50`…`100` | `98` | OKLCH lightness (percent) of the colour ramps' palest step. Not the neutral. |
@@ -484,7 +600,7 @@ A seed file:
484
600
  | `--chroma-peak` | `25`…`950` | the seed's step | Where `--chroma peak` peaks. |
485
601
  | `--hue-drift` | `none` · `natural` · degrees | `none` | How the hue turns in the darks. Not the neutral. |
486
602
  | `--pin` | `family@step=colour` | — | An exact colour on a step; the ramp bends through it. Repeatable. |
487
- | `--no-aliases` | — | — | Each status ramp once, as success, destructive and warning, without green, red and yellow as second names for the same ramps. |
603
+ | `--aliases` | — | — | Also emit green, red and yellow as second names for the success, destructive and warning ramps. Off by default from 0.12 (`--no-aliases` is still accepted). |
488
604
  | `--contract` | — | — | Print the step contract: steps that carry text on white or black in some colours and not others. |
489
605
  | `--gamut` | `srgb` · `p3` | `srgb` | Which displays to generate for. |
490
606
  | `--shades` | `tailwind` · `full` · a list | `full` | Which steps to emit. |
@@ -512,9 +628,9 @@ Before 0.5.0, `--seed-shade` moved every family. A pale brand colour anchored at
512
628
 
513
629
  **The semantics follow the anchor too.** `--primary`, its subdued tint, and where `--ring` starts are positions relative to the seed, not fixed steps, and every other family's semantics are relative to that family's own anchor — so `bg-primary` is your brand colour wherever you anchor it. Before 0.4.0 they were pinned to 500, which meant anchoring a deep navy at 800 left `--primary` pointing at a pale mid-tone the brand never chose, with no way to reach the real one through `bg-primary` at all.
514
630
 
515
- `muted`, `border`, `input` and `shadow` stay where they are: they read the neutral ramp, not your brand, and re-anchoring the whole UI's greys is a different thing from placing a brand colour.
631
+ The neutral's quiet panel, `border`, `input` and `shadow` stay where they are: they read the neutral ramp, not your brand, and re-anchoring the whole UI's greys is a different thing from placing a brand colour.
516
632
 
517
- **Three tokens are searched to a contrast floor.** The focus ring and an input's edge are non-text UI that WCAG 1.4.11 holds to 3:1, and muted text is text. A fixed step meets those for some colours and not others, so each starts at its usual step and moves away from the background (darker in light mode, lighter in dark) until it clears its floor against the canvas and the surface: 3:1 for `ring` and `input`, 4.5:1 for `muted-foreground` (7:1 with `--target aaa`). `border` keeps its fixed step, because round a card it is decoration. An override in `utilityShadeOverrides` still wins. Before 0.7.0 these were fixed, and a teal brand on a warm grey shipped a 2.7:1 ring, a 1.6:1 input edge and 4.3:1 muted text.
633
+ **The ring, an input's edge and secondary text are searched to a contrast floor.** The focus ring and an input's edge are non-text UI that WCAG 1.4.11 holds to 3:1, and secondary text is text. A fixed step meets those for some colours and not others, so each starts at its usual step and moves away from the background (darker in light mode, lighter in dark) until it clears its floor: 3:1 for `ring` and `input` against the canvas and the surface, 4.5:1 for each surface's `-foreground-secondary` on that surface (7:1 with `--target aaa`). Set one by hand with `surfaceShadeOverrides` (`"canvas-foreground-secondary": 700`). `border` keeps its fixed step, because round a card it is decoration. An override in `utilityShadeOverrides` still wins. Before 0.7.0 these were fixed, and a teal brand on a warm grey shipped a 2.7:1 ring, a 1.6:1 input edge and 4.3:1 secondary text.
518
634
 
519
635
  `--report` prints where the bridge landed, so you can check rather than infer:
520
636
 
@@ -577,10 +693,10 @@ A seed outside sRGB is reported on stderr, since its step will not be the colour
577
693
 
578
694
  - **`ramp`** — the colour ramps alone. This is "hand me a colour, hand me back scales".
579
695
  - **`primitives`** — the ramps plus `--color-black` and `--color-white`.
580
- - **`semantic`** — `--primary`, `--destructive-subdued-foreground`, `--muted`, …
696
+ - **`semantic`** — `--primary`, `--destructive-subdued-foreground`, `--neutral-subdued`, …
581
697
  - **`surface`** — `--canvas`, `--surface`, `--overlay` and their foregrounds.
582
698
  - **`utility`** — `--border`, `--input`, `--ring`, `--shadow`.
583
- - **`grounds`** — `--on-<ground>-*` in each mode block and the `[data-surface]` scopes.
699
+ - **`grounds`** — the `[data-surface]` scopes. (A ground's selector on its mode block comes with `semantic`.)
584
700
 
585
701
  Beyond convenience, this keeps generated colour separable from files a project hand-tunes, so re-theming does not clobber them:
586
702
 
@@ -627,9 +743,9 @@ fills moved from the offset table
627
743
  dark primary fill 600 -> 500 (a light colour under a black label keeps its own step)
628
744
  ...
629
745
 
630
- searched to their contrast floor (ring and input 3:1 on canvas and surface; muted text on muted)
631
- light ring primary-600 (from 400) input neutral-500 (from 200) muted-foreground neutral-600 (from 500)
632
- dark ring primary-600 (from 700) input neutral-500 (from 800) muted-foreground neutral-200
746
+ searched to their contrast floor (ring and input 3:1 on canvas and surface; secondary text on its surface)
747
+ light ring primary-600 (from 400) input neutral-500 (from 200) secondary text: canvas neutral-600 (from 500), surface neutral-600 (from 500), overlay neutral-600 (from 500)
748
+ dark ring primary-600 (from 700) input neutral-500 (from 800) secondary text: canvas neutral-200, surface neutral-200, overlay neutral-200
633
749
 
634
750
  ramp chroma (peak C per family)
635
751
  primary 0.0815 at 500
@@ -671,7 +787,7 @@ On Tailwind v4 a token only becomes a usable class if it sits inside a `@theme`
671
787
  }
672
788
  ```
673
789
 
674
- You get `bg-primary`, `text-primary-foreground`, `bg-canvas`, `border-border` **and** `bg-primary-500`, in both modes, and on every [ground](#grounds-content-on-coloured-backgrounds): each `[data-surface]` scope re-binds the aliases it re-points, for the same reason the mode blocks do.
790
+ You get `bg-primary`, `text-primary-foreground`, `bg-canvas`, `border-border` **and** `bg-primary-500`, in both modes, and on every [ground](#grounds): each `[data-surface]` scope re-binds the aliases it re-points, for the same reason the mode blocks do.
675
791
 
676
792
  Three details carry the weight, each verified against a real Tailwind compile:
677
793
 
@@ -711,7 +827,7 @@ Two consequences, both of which have cost real projects real time:
711
827
 
712
828
  Then check **both** colour schemes, not whichever your tool defaults to.
713
829
 
714
- **A token on one ground** is overridden on its scope, `[data-surface="brand"] { --neutral: transparent; }`, after the generated file and unlayered. One selector covers both modes, because the scope reads each mode's `--on-brand-*` value; to change a ground in one mode only, override `--on-brand-neutral` in that mode's selector instead.
830
+ **A token on one ground** is overridden on its scope, `[data-surface="pine"] { --border: var(--color-pine-600); }`, after the generated file and unlayered. A ground has no modes, so one selector is the whole of it. Better still, say it in the generator: `--ground-tint pine=pine-600`.
715
831
 
716
832
  **Change a ramp step through its seed, not by overriding it.** Tailwind v4 utilities do read ramp steps through `var()` (checked against a Tailwind 4.3 compile), which is what lets the `--gamut p3` layer work. The one exception is an opacity modifier: `bg-primary-500/50` also emits the step's literal value as a fallback for browsers without `color-mix()`, and an override cannot reach that. But a hand-overridden step is a fork of the palette that the contrast search never saw and `--check` cannot detect. If you need a ramp step to change, change the seed and regenerate, or point the call sites at a token you do own.
717
833
 
@@ -723,7 +839,7 @@ If you find yourself hand-writing a colour beside the generated file, that is th
723
839
 
724
840
  - **Deterministic.** Same inputs and version produce byte-identical output. No randomness, clocks, or environment reads. (A grey has no meaningful hue, so `hsl` output prints it as 0 rather than float noise that differs across engines.)
725
841
  - **Displayable.** Every value is inside sRGB, so the colour in the file is the colour on the page, and contrast is measured on the colour a browser paints. With `--gamut p3`, the wide layer is inside Display P3.
726
- - **Every ground reads.** Inside each `data-surface`, every button fill stands out from the ground at 3:1 with a label that reads on it, the input edge and focus ring reach 3:1, and muted and status text read at the text floor, or `--report` names what couldn't. A token that already worked keeps the page's value.
842
+ - **Every ground reads.** Inside each `data-surface`, body text reaches the text floor on the ground and on its card, each one's secondary text 4.5:1 and quieter than its body text (or the body text itself, noted, where nothing quieter reads), the input edge and focus ring 3:1, every label reads on its fill, and the primary button stands out from the ground at 3:1 (a tonal secondary button leans on its label instead, as WCAG allows a labelled control). A `page` or one-colour value isn't searched, but is measured, and `--report` names what couldn't reach its floor. A token that works keeps the page's value.
727
843
  - **Two test tiers.** Golden fixtures pin the bytes; structural invariants pin what a fixture cannot — chiefly that every `var(--x)` an export emits resolves to a `--x:` the same output defines. Bytes can be stable and still be incoherent CSS.
728
844
  - **One dependency**, pure JS: `culori` (colour maths). APCA contrast uses the optional `apca-w3`.
729
845
  - **ESM**, Node 18+.