@designtools/tokens 0.3.0 → 0.5.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 +85 -0
- package/README.md +402 -119
- package/dist/{chunk-3OG7U5V2.js → chunk-D6675UF5.js} +598 -199
- package/dist/cli.js +318 -41
- package/dist/index.d.ts +298 -22
- package/dist/index.js +27 -1
- package/package.json +39 -4
package/README.md
CHANGED
|
@@ -1,26 +1,227 @@
|
|
|
1
1
|
# @designtools/tokens
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**One brand colour in, a complete design-token system out.** A CLI that turns `#4e9caf` into ~220 CSS custom properties — colour ramps, semantic intents, surfaces, borders — in light and dark mode, ready to drop into a project.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
```
|
|
6
|
+
npx @designtools/tokens --primary "#4e9caf" --out tokens.css
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Not a palette generator with extra steps. Most tools rotate hue and step lightness in HSL, then leave contrast to you — which is how you end up with ramps that look even in a swatch grid and fall apart in a UI.
|
|
10
|
+
|
|
11
|
+
This one works in **OKLCH**, so equal steps are equal *perceptual* steps and the ramps stay balanced without hand-tweaking. Lightness is a fraction of the headroom either side of your colour rather than a fixed position, so a pale tint and a near-black both get a usable scale. Chroma follows its own easing curve, so light tints stay clean instead of going muddy while the interactive range stays saturated.
|
|
12
|
+
|
|
13
|
+
And **every foreground is measured, not assumed.** For each background it generates, it walks the scale computing real contrast — WCAG or APCA — and picks the shade closest to a comfortable target among those clearing your floor. `--report` prints what it achieved, so accessibility is something you can assert in CI rather than hope for:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
light mode (wcag, target aa)
|
|
17
|
+
AA primary/default 5.19:1
|
|
18
|
+
- neutral/default 4.30:1
|
|
19
|
+
score: 93% (14/15 pairings)
|
|
20
|
+
```
|
|
21
|
+
|
|
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
|
+
|
|
24
|
+
## What it generates
|
|
25
|
+
|
|
26
|
+
From a single seed colour:
|
|
27
|
+
|
|
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.
|
|
29
|
+
|
|
30
|
+
```css
|
|
31
|
+
--color-primary-25: oklch(97.34% 0.0065 215.79);
|
|
32
|
+
--color-primary-500: oklch(65.07% 0.0815 215.79); /* your seed, exactly */
|
|
33
|
+
--color-primary-950: oklch(17.50% 0.0766 215.79);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Semantic intents** — what you actually write in components. Each of `primary`, `neutral`, `success`, `destructive`, `warning` gets six slots, plus a `muted` pair:
|
|
37
|
+
|
|
38
|
+
```css
|
|
39
|
+
--primary --primary-foreground
|
|
40
|
+
--primary-subdued --primary-subdued-foreground
|
|
41
|
+
--primary-highlight --primary-highlight-foreground
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Every `-foreground` is chosen by **contrast search**, not a fixed mapping — the generator measures each candidate against its background and picks one that clears your target (WCAG AA by default, or APCA).
|
|
6
45
|
|
|
7
|
-
|
|
46
|
+
**Surfaces and utilities** — `--canvas`, `--surface`, `--overlay` with paired foregrounds, plus `--border`, `--input`, `--ring`, `--shadow`.
|
|
8
47
|
|
|
9
|
-
|
|
48
|
+
**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:
|
|
10
49
|
|
|
50
|
+
```css
|
|
51
|
+
:root { /* the ramps */ }
|
|
52
|
+
:root, [data-theme="light"] { /* light intents */ }
|
|
53
|
+
[data-theme="dark"] { /* dark intents */ }
|
|
54
|
+
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { … } }
|
|
11
55
|
```
|
|
12
|
-
|
|
13
|
-
|
|
56
|
+
|
|
57
|
+
## Try it
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# print CSS custom properties to stdout
|
|
61
|
+
npx @designtools/tokens --primary "#4e9caf"
|
|
62
|
+
|
|
63
|
+
# write a file
|
|
64
|
+
npx @designtools/tokens --primary "#4e9caf" --out src/tokens.css
|
|
65
|
+
|
|
66
|
+
# a Tailwind v4 theme
|
|
67
|
+
npx @designtools/tokens --primary "#4e9caf" --format tailwind-v4 --out src/theme.css
|
|
68
|
+
|
|
69
|
+
# add your own scales
|
|
70
|
+
npx @designtools/tokens --primary "#4e9caf" --color accent=#8b5cf6 --color info=#0ea5e9
|
|
71
|
+
|
|
72
|
+
# just the ramps, as JSON
|
|
73
|
+
npx @designtools/tokens --primary "#4e9caf" --only ramp --format json
|
|
74
|
+
|
|
75
|
+
# every format at once
|
|
14
76
|
npx @designtools/tokens --primary "#4e9caf" --format all --out ./tokens
|
|
15
77
|
```
|
|
16
78
|
|
|
17
|
-
|
|
79
|
+
Any CSS colour works as a seed: `#4e9caf`, `rgb(78 156 175)`, `hsl(193 39% 50%)`, `oklch(65% 0.08 216)`, `rebeccapurple`.
|
|
80
|
+
|
|
81
|
+
## Why the output holds up
|
|
82
|
+
|
|
83
|
+
### Lightness adapts to the colour you gave it
|
|
84
|
+
|
|
85
|
+
Steps are a fraction of the *headroom* above and below your seed rather than fixed positions, so a pale tint and a near-black both get a usable ramp instead of one end collapsing.
|
|
86
|
+
|
|
87
|
+
Chromatic and achromatic seeds get different curves — anything under 0.01 chroma counts as achromatic. Colour gets eased transitions at the extremes and vivid mid-tones; greys get a flatter spread tuned for surface layering and text contrast.
|
|
88
|
+
|
|
89
|
+
### Chroma has its own curve
|
|
90
|
+
|
|
91
|
+
Held near-neutral at the light end so tints stay clean, at full strength through the interactive range. Measured on `#4e9caf`:
|
|
92
|
+
|
|
93
|
+
| shade | 25 | 100 | 300 | 400 | 500–800 | 900 | 950 |
|
|
94
|
+
|---|---|---|---|---|---|---|---|
|
|
95
|
+
| chroma vs. seed | 8% | 38% | 87% | 96% | **100%** | 96% | 94% |
|
|
96
|
+
|
|
97
|
+
Hue is held constant across the whole scale — no Bezold–Brücke correction, no artistic rotation — so shade 900 is unmistakably the same colour as shade 100.
|
|
98
|
+
|
|
99
|
+
### Every colour is one a screen can show
|
|
100
|
+
|
|
101
|
+
OKLCH can describe colours more saturated than any screen displays, and near white and near black a screen can show very little chroma at all. A saturated seed held at full chroma down its ramp goes out of gamut at both ends: in 0.4.0, `#2f6fed` produced 36 of 48 primitives across its primary and status ramps that no browser renders as written.
|
|
18
102
|
|
|
103
|
+
So each step's chroma is capped at the most sRGB holds at that step's lightness and hue. Lightness and hue never move, only chroma, so a step keeps its place in the ramp. The value in the file is the colour on the page, in every browser.
|
|
104
|
+
|
|
105
|
+
Contrast is measured on the colour that is displayed, too. A browser maps an out-of-gamut colour into the screen's gamut when it paints (the CSS Color 4 algorithm), and the checks measure that same mapped colour, so a value that arrives out of gamut, such as a seed or a hand-edited token, is scored as it will be seen. Before 0.5.0, APCA scored such pairings Lc 0 and the foreground search chose blind.
|
|
106
|
+
|
|
107
|
+
For wide-gamut displays there is [`--gamut p3`](#--gamut--which-displays).
|
|
108
|
+
|
|
109
|
+
### Foregrounds are searched, not mapped
|
|
110
|
+
|
|
111
|
+
For every background it generates, the tool computes real contrast against each candidate shade and picks the one **closest to a comfortable target among those clearing your floor** — not the first that scrapes past, which would hand you the least legible passing option every time. If nothing in the colour's own scale qualifies it falls back to the neutral scale, then to black or white.
|
|
112
|
+
|
|
113
|
+
- **WCAG 2.x** (default) — `(L₁ + 0.05) / (L₂ + 0.05)`, with floors of 3:1 (`--target aa-large`), 4.5:1 (`aa`) and 7:1 (`aaa`). Widely adopted and legally referenced, but it treats dark-on-light and light-on-dark identically and has no concept of text size.
|
|
114
|
+
- **APCA** (`--contrast apca`) — models how contrast is actually perceived, so the same two colours score differently depending on which one is the text. Bands at Lc 45 (large text), Lc 60 (larger content), Lc 75 (body text), Lc 90 (fluent reading).
|
|
115
|
+
|
|
116
|
+
### Dark mode is derived, not inverted
|
|
117
|
+
|
|
118
|
+
Both modes come from the same ramps via different shade mappings, and the contrast search re-runs for each — so a dark foreground is chosen against dark backgrounds rather than inherited from a flipped light palette.
|
|
119
|
+
|
|
120
|
+
### Status colours belong to your palette
|
|
121
|
+
|
|
122
|
+
Success, destructive and warning are derived from your primary rather than bolted on: the generator reads the primary's chroma and lightness and builds them at matching energy on fixed hues (145°, 25°, 75°), clamped so red still reads as danger and amber still reads as caution. They sit in your colour world instead of looking borrowed from Bootstrap.
|
|
123
|
+
|
|
124
|
+
## For AI agents
|
|
125
|
+
|
|
126
|
+
This is deliberately a **dumb, deterministic tool** — no model, no network, no hidden state — which is what makes it safe to hand to an agent:
|
|
127
|
+
|
|
128
|
+
- **Deterministic.** Same flags always produce the same bytes, so a re-run is a no-op and a diff means something really changed.
|
|
129
|
+
- **stdout by default**, `--out` to write. Pipes cleanly.
|
|
130
|
+
- **Fails loudly.** Unknown values are rejected with the valid set, rather than silently ignored.
|
|
131
|
+
- **`--check` for CI.** Regenerates in memory, compares against the file on disk, exits non-zero on drift — no temp dirs, no diffing ritual.
|
|
132
|
+
- **`--report` for a11y assertions.** Prints the measured contrast of every pairing with a score.
|
|
133
|
+
- **`--ramps` + `--merge` for partial regeneration.** Change one colour in a file a human has also edited, without rewriting their work. See [Regenerating part of a token file](#regenerating-part-of-a-token-file).
|
|
134
|
+
- **`--only` for tier-level slicing.** Keep generated colour in a different file from anything hand-tuned.
|
|
135
|
+
- **`--seed` / `--stdin`** to replay a whole configuration from JSON instead of assembling flags.
|
|
136
|
+
|
|
137
|
+
Generated files carry a provenance header naming the version and a hash of the inputs, so an agent can tell "the generator was upgraded" apart from "a human edited this":
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
/* Generated by @designtools/tokens v0.4.0 (seed e06984b1) - do not edit by hand */
|
|
19
141
|
```
|
|
20
|
-
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# in CI: fail if tokens.css no longer matches its inputs
|
|
145
|
+
npx @designtools/tokens --primary "#4e9caf" --out tokens.css --check
|
|
146
|
+
```
|
|
147
|
+
|
|
21
148
|
```
|
|
149
|
+
check: tokens.css up to date
|
|
150
|
+
check: tokens.css differs — seed e06984b1 on disk, 7b5a14d2 now. The inputs changed; regenerate.
|
|
151
|
+
check: tokens.css differs — same generator and seed, so the file was edited by hand.
|
|
152
|
+
check: tokens.css differs — generated by v0.4.0, running v0.5.0. Expected after a generator upgrade.
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Regenerating part of a token file
|
|
156
|
+
|
|
157
|
+
The problem this solves: an agent asked to "change the reds" regenerates the whole file and wipes out every hand-edit someone made to the primary.
|
|
158
|
+
|
|
159
|
+
Scope the run to a **colour family** — one colour plus everything computed against it — and merge it in:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# regenerate just the reds, in place, leaving the rest of the file alone
|
|
163
|
+
generate-tokens --primary "#4e9caf" --color destructive=#ff0000 \
|
|
164
|
+
--ramps destructive --out tokens.css --merge
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
merged into tokens.css: 33 updated, 0 added, 9 already current
|
|
169
|
+
slice references 1 token defined elsewhere:
|
|
170
|
+
--color-neutral-950
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Adding a colour works the same way, and touches nothing that already existed:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
generate-tokens --primary "#4e9caf" --color accent=#8b5cf6 \
|
|
177
|
+
--ramps accent --out tokens.css --merge
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Why a family, and why merge
|
|
181
|
+
|
|
182
|
+
A family is the right unit because **the contrast search runs inside it**. Change the ramp and the foregrounds change with it — they are chosen *against* those values. Regenerate `destructive` and this happens:
|
|
183
|
+
|
|
184
|
+
| | background | foreground | ratio |
|
|
185
|
+
|---|---|---|---|
|
|
186
|
+
| before | dark red | near-white | 5.28:1 ✅ |
|
|
187
|
+
| after | brighter red | **near-black** | 4.72:1 ✅ |
|
|
188
|
+
| ramp pasted in on its own | brighter red | stale near-white | **3.66:1 ❌** |
|
|
189
|
+
|
|
190
|
+
Splice only the twelve steps and you keep a foreground that no longer passes — silently, because nothing re-checks it.
|
|
191
|
+
|
|
192
|
+
`--merge` exists for the same reason. A family is not one contiguous block: its ramp sits in `:root` and its semantics repeat in the light block, the dark block **and** the `prefers-color-scheme` fallback. That last one is the copy a hand-splice forgets, leaving system-dark on the old colour while the toggle shows the new one. `--merge` rewrites all four and leaves every other line byte-identical.
|
|
22
193
|
|
|
23
|
-
|
|
194
|
+
Surfaces and utilities belong to no single colour, so a family-scoped slice never touches them.
|
|
195
|
+
|
|
196
|
+
### Checking a part-generated file
|
|
197
|
+
|
|
198
|
+
A full `--check` is useless once a file has hand-edited regions — it reports drift forever. Scope the check the same way and it only compares what this run generates:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
generate-tokens --primary "#4e9caf" --color destructive=#ff0000 \
|
|
202
|
+
--ramps destructive --out tokens.css --check
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
check: tokens.css up to date for destructive
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
So an agent's contract is *scope, merge, verify* — and a bad merge is caught rather than shipped.
|
|
210
|
+
|
|
211
|
+
### Aliases move together
|
|
212
|
+
|
|
213
|
+
`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.
|
|
214
|
+
|
|
215
|
+
## Upgrading to 0.5.0
|
|
216
|
+
|
|
217
|
+
0.5.0 changes output for any saturated seed, so `--check` will report the version change until you regenerate. What moves:
|
|
218
|
+
|
|
219
|
+
- **Ramp steps that were outside sRGB** have their chroma capped to fit. Lightness and hue are unchanged, and a step that was already displayable is byte-identical. Pale and muted seeds are often untouched.
|
|
220
|
+
- **hex, rgb and hsl output of those steps** is the gamut-mapped colour a browser paints, not a channel-by-channel clip that shifted hue.
|
|
221
|
+
- **Some foregrounds**, where the search can now measure a background it could not before.
|
|
222
|
+
- **`--seed-shade` moves the primary only.** If you relied on it moving the neutral or status colours, anchor them explicitly with `--neutral-seed-shade` and `--color name=colour@shade`.
|
|
223
|
+
|
|
224
|
+
## Programmatic use
|
|
24
225
|
|
|
25
226
|
```ts
|
|
26
227
|
import { generateTokens, exportTokens } from "@designtools/tokens";
|
|
@@ -29,32 +230,61 @@ const tokens = generateTokens({ primary: "#4e9caf", neutral: "#9aa1af" });
|
|
|
29
230
|
const css = exportTokens(tokens, "css", { colorFormat: "oklch" });
|
|
30
231
|
```
|
|
31
232
|
|
|
233
|
+
`generateTokens` returns a structured `TokenSystem`; `exportTokens` serialises it. Everything the CLI does is available here. No browser, DOM, or React — it runs anywhere.
|
|
234
|
+
|
|
235
|
+
The anchors have to be passed to both: **`seedShade`** (the primary's) and **`seedShades`** (every other family's, by name). The semantic bridge is expressed as offsets from each anchor, so an export that does not know where the seeds sit emits `var()` references the resolved values in `tokens` disagree with. Pass the same values to each, as the CLI does:
|
|
236
|
+
|
|
237
|
+
```ts
|
|
238
|
+
const anchors = { seedShade: 800, seedShades: { neutral: 200, accent: 300 } } as const;
|
|
239
|
+
const tokens = generateTokens(
|
|
240
|
+
{ primary: "#1e3a5f", neutral: "#e7e5e4", additionalColors: { accent: "#fde68a" } },
|
|
241
|
+
anchors
|
|
242
|
+
);
|
|
243
|
+
const css = exportTokens(tokens, "css", { colorFormat: "oklch", ...anchors });
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
With `gamut: "p3"`, the wide-gamut tiers are on `tokens.p3`, and the checks take the gamut to measure on: `checkSemanticContrast(tokens.p3.semantic.light, "p3")`.
|
|
247
|
+
|
|
248
|
+
## Output formats
|
|
249
|
+
|
|
250
|
+
| `--format` | File under `--format all` | What it is |
|
|
251
|
+
|---|---|---|
|
|
252
|
+
| `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`. |
|
|
253
|
+
| `tailwind-v4` | `tailwind.css` | A complete `@theme static` block. See [Tailwind v4](#tailwind-v4). |
|
|
254
|
+
| `tailwind-v3` | `tailwind.config.js` | `theme.extend.colors` config. |
|
|
255
|
+
| `dtcg` | `tokens.dtcg.json` | W3C Design Token Community Group JSON. |
|
|
256
|
+
| `json` | `tokens.json` | The raw `TokenSystem`, for downstream tooling. |
|
|
257
|
+
|
|
258
|
+
`--color-format` controls how literal values are printed: `oklch` (default), `hex`, `rgb`, `hsl`.
|
|
259
|
+
|
|
32
260
|
## CLI reference
|
|
33
261
|
|
|
34
|
-
`--primary` is the only required input, and even that can come from
|
|
262
|
+
`--primary` is the only required input, and even that can come from `--seed`.
|
|
35
263
|
|
|
36
264
|
### Seeds
|
|
37
265
|
|
|
38
266
|
| Flag | Default | What it does |
|
|
39
267
|
|---|---|---|
|
|
40
|
-
| `--primary <colour>` | — |
|
|
268
|
+
| `--primary <colour>` | — | Your brand colour. Required unless `--seed` supplies it. |
|
|
41
269
|
| `--neutral <colour>` | `#747474` | Neutral seed. Drives greys, surfaces, borders. |
|
|
42
|
-
| `--color <name>=<colour
|
|
43
|
-
| `--seed <file.json>` | — | Replay a saved configuration. Flags given alongside it win, so a seed is
|
|
44
|
-
| `--stdin` | off | Read
|
|
270
|
+
| `--color <name>=<colour>[@<shade>]` | — | An extra named scale. Repeatable. `@<shade>` anchors its seed on that step. |
|
|
271
|
+
| `--seed <file.json>` | — | Replay a saved configuration. Flags given alongside it win, so a seed is defaults rather than a lock. |
|
|
272
|
+
| `--stdin` | off | Read that same JSON from standard input. |
|
|
45
273
|
|
|
46
|
-
A seed file
|
|
274
|
+
A seed file:
|
|
47
275
|
|
|
48
276
|
```json
|
|
49
277
|
{
|
|
50
278
|
"primaryColor": "#7c3aed",
|
|
51
279
|
"neutralColor": "#747474",
|
|
52
|
-
"additionalColors": [{ "name": "accent", "color": "#f59e0b" }],
|
|
280
|
+
"additionalColors": [{ "name": "accent", "color": "#f59e0b", "seedShade": 500 }],
|
|
53
281
|
"colorFormat": "hex",
|
|
54
282
|
"contrastAlgorithm": "apca",
|
|
55
283
|
"contrastTarget": "aaa",
|
|
56
284
|
"lightnessStrategy": "perceptual",
|
|
57
285
|
"seedShade": 500,
|
|
286
|
+
"neutralSeedShade": 500,
|
|
287
|
+
"gamut": "srgb",
|
|
58
288
|
"shades": [25, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950],
|
|
59
289
|
"shadeOverrides": {}
|
|
60
290
|
}
|
|
@@ -65,130 +295,177 @@ A seed file is a `SavedConfig` — the shape the web tool persists — so the tw
|
|
|
65
295
|
| Flag | Values | Default | What it does |
|
|
66
296
|
|---|---|---|---|
|
|
67
297
|
| `--contrast` | `wcag` · `apca` | `wcag` | Which algorithm picks foregrounds. |
|
|
68
|
-
| `--target` | `aa-large` · `aa` · `aaa` | `aa` | Minimum the foreground search
|
|
69
|
-
| `--lightness` | `fixed` · `perceptual` | `fixed` | How lightness is
|
|
70
|
-
| `--seed-shade` | `25`…`950` | `500` | Which step
|
|
298
|
+
| `--target` | `aa-large` · `aa` · `aaa` | `aa` | Minimum the foreground search must clear. |
|
|
299
|
+
| `--lightness` | `fixed` · `perceptual` | `fixed` | How lightness is spread across the steps. |
|
|
300
|
+
| `--seed-shade` | `25`…`950` | `500` | Which step your primary lands on. |
|
|
301
|
+
| `--neutral-seed-shade` | `25`…`950` | `500` | Which step your neutral lands on. |
|
|
302
|
+
| `--gamut` | `srgb` · `p3` | `srgb` | Which displays to generate for. |
|
|
71
303
|
| `--shades` | `tailwind` · `full` · a list | `full` | Which steps to emit. |
|
|
72
|
-
| `--overrides <file.json>` | — | — |
|
|
304
|
+
| `--overrides <file.json>` | — | — | Per-token shade overrides. |
|
|
73
305
|
|
|
74
|
-
#### `--seed-shade` — where
|
|
306
|
+
#### `--seed-shade` — where your brand colour sits
|
|
75
307
|
|
|
76
|
-
|
|
308
|
+
Everything is derived from the headroom above and below the seed, so where it sits matters. Brand colours arrive as whatever they are: pin a deep navy to the middle of the ramp and there is almost nothing left underneath, so the dark end collapses; pin a pale tint there and the light end has nowhere to go.
|
|
77
309
|
|
|
78
|
-
```
|
|
310
|
+
```bash
|
|
79
311
|
generate-tokens --primary "#1e3a5f" --seed-shade 800 # deep navy belongs near the bottom
|
|
80
312
|
generate-tokens --primary "#fde68a" --seed-shade 200 # pale amber belongs near the top
|
|
81
313
|
```
|
|
82
314
|
|
|
83
|
-
|
|
315
|
+
Your colour is still reproduced exactly, just at the step you name. The ramp keeps its shape — gentle at the light end, larger jumps at the dark end for text contrast — and peak chroma follows the seed.
|
|
84
316
|
|
|
85
|
-
|
|
317
|
+
**Each colour has its own anchor.** `--seed-shade` moves the primary only. The neutral takes `--neutral-seed-shade`, an added colour takes `@<shade>` on `--color`, and the derived status colours, which are built at mid lightness, stay on 500:
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
generate-tokens --primary "#fde68a" --seed-shade 200 \
|
|
321
|
+
--neutral "#e7e5e4" --neutral-seed-shade 100 \
|
|
322
|
+
--color accent=#1e3a5f@800
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Before 0.5.0, `--seed-shade` moved every family. A pale brand colour anchored at 200 dragged the neutral to 200 with it, so `#CECECE` became `neutral-200` and the whole grey ramp darkened. A pale brand does not imply a pale grey.
|
|
326
|
+
|
|
327
|
+
**The semantics follow the anchor too.** `--primary`, its subdued and highlight variants, and `--ring` 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.
|
|
86
328
|
|
|
87
|
-
|
|
329
|
+
`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.
|
|
88
330
|
|
|
331
|
+
`--report` prints where the bridge landed, so you can check rather than infer:
|
|
332
|
+
|
|
333
|
+
```
|
|
334
|
+
semantic bridge for primary, anchored at 800 (neutral at 200; other families at 500)
|
|
335
|
+
light default 800 subdued 300 highlight 950 ring 700
|
|
336
|
+
dark default 900 subdued 500 highlight 700 ring 950
|
|
89
337
|
```
|
|
338
|
+
|
|
339
|
+
#### `--shades` — which steps exist
|
|
340
|
+
|
|
341
|
+
The default is 25–950 (12 steps). Tailwind's stock ramps are 50–950 (11, no 25), and matching that makes the Tailwind override exact:
|
|
342
|
+
|
|
343
|
+
```bash
|
|
90
344
|
generate-tokens --primary "#4e9caf" --shades tailwind # 50–950
|
|
91
345
|
generate-tokens --primary "#4e9caf" --shades 100,500,900 # a coarse three-step ramp
|
|
92
346
|
```
|
|
93
347
|
|
|
94
|
-
Some tokens name specific steps — `muted` and light `canvas` both sit on 25
|
|
348
|
+
Some tokens name specific steps — `muted` and light `canvas` both sit on 25 — so dropping a step could leave a `var()` pointing at nothing. References snap to the nearest emitted step instead, and every substitution is reported, because snapping quietly changes a design decision:
|
|
95
349
|
|
|
96
350
|
```
|
|
97
|
-
|
|
98
|
-
--shades 50,100,200,300,400,500,600,700,800,900,950 drops steps some tokens name; snapped to nearest:
|
|
351
|
+
--shades 50,100,…,950 drops steps some tokens name; snapped to nearest:
|
|
99
352
|
muted (light): 25 -> 50
|
|
100
353
|
canvas (light): 25 -> 50
|
|
101
354
|
```
|
|
102
355
|
|
|
103
|
-
|
|
356
|
+
A shade set needs at least three steps, and every anchor (`--seed-shade`, `--neutral-seed-shade`, `@<shade>`) must be one of them.
|
|
357
|
+
|
|
358
|
+
#### `--gamut` — which displays
|
|
359
|
+
|
|
360
|
+
By default every colour is inside sRGB, the gamut every screen shows. Most phones and Macs can show more: Display P3 holds noticeably more chroma, most of all near white and near black, which is exactly where sRGB caps a vivid ramp hardest.
|
|
361
|
+
|
|
362
|
+
`--gamut p3` keeps the sRGB output exactly as it is and adds a wide-gamut layer after it. For `#2f6fed`:
|
|
363
|
+
|
|
364
|
+
```css
|
|
365
|
+
:root {
|
|
366
|
+
--color-primary-50: oklch(95.16% 0.0229 262.00); /* sRGB: every screen */
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
@media (color-gamut: p3) {
|
|
370
|
+
:root {
|
|
371
|
+
--color-primary-50: oklch(95.16% 0.0252 262.00); /* P3 screens */
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
Only the ramps are re-declared: semantic, surface and utility tokens are `var()` references to ramp steps, so they follow, and Tailwind v4 utilities read `var(--color-*)` too. Every ramp step is re-declared, not just those that differ, so a `--merge` after a re-seed cannot leave a stale value behind that only P3 screens would show.
|
|
377
|
+
|
|
378
|
+
**Every foreground is chosen to pass on both.** The search scores each candidate on sRGB and on P3 and keeps the worse, so the step it picks clears the floor on either kind of screen, and both tiers read the same steps. Where no step clears it on both, it takes the one with the best worst case, as it does when no step clears it at all. `--report` measures both.
|
|
379
|
+
|
|
380
|
+
Values in the layer are always printed as `oklch`, since `hex`, `rgb()` and `hsl()` can only hold sRGB. `tailwind-v3` and `dtcg` cannot carry the layer and say so on stderr; `json` carries it as `p3`.
|
|
381
|
+
|
|
382
|
+
A seed outside sRGB is reported on stderr, since its step will not be the colour as given: its chroma is reduced to fit, keeping lightness and hue. With `--gamut p3` the wide layer keeps it as given if P3 can show it.
|
|
104
383
|
|
|
105
384
|
### Selection
|
|
106
385
|
|
|
107
386
|
| Flag | Values | What it does |
|
|
108
387
|
|---|---|---|
|
|
109
|
-
| `--only <sections>` | `ramp` · `primitives` · `semantic` · `surface` · `utility` | Emit only these
|
|
388
|
+
| `--only <sections>` | `ramp` · `primitives` · `semantic` · `surface` · `utility` | Emit only these tiers. Comma-separated or repeated. |
|
|
389
|
+
| `--ramps <names>` | any colour family | Emit only these colour families. See [Regenerating part of a token file](#regenerating-part-of-a-token-file). |
|
|
110
390
|
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
391
|
+
- **`ramp`** — the colour ramps alone. This is "hand me a colour, hand me back scales".
|
|
392
|
+
- **`primitives`** — the ramps plus `--color-black` and `--color-white`.
|
|
393
|
+
- **`semantic`** — `--primary`, `--destructive-subdued-foreground`, `--muted`, …
|
|
394
|
+
- **`surface`** — `--canvas`, `--surface`, `--overlay` and their foregrounds.
|
|
395
|
+
- **`utility`** — `--border`, `--input`, `--ring`, `--shadow`.
|
|
116
396
|
|
|
117
|
-
|
|
397
|
+
Beyond convenience, this keeps generated colour separable from files a project hand-tunes, so re-theming does not clobber them:
|
|
118
398
|
|
|
119
|
-
```
|
|
399
|
+
```bash
|
|
120
400
|
# scaffold: everything, once
|
|
121
401
|
generate-tokens --primary "#4e9caf" --out tokens.css
|
|
122
402
|
|
|
123
403
|
# re-theme: colour only, leaving hand-tuned files alone
|
|
124
404
|
generate-tokens --primary "#c0392b" --only primitives,semantic --out tokens.colour.css
|
|
125
|
-
|
|
126
|
-
# just the ramps, for a palette reference
|
|
127
|
-
generate-tokens --primary "#4e9caf" --only ramp --format json
|
|
128
405
|
```
|
|
129
406
|
|
|
130
|
-
Supported by `css`, `tailwind-v4` and `json`;
|
|
407
|
+
Supported by `css`, `tailwind-v4` and `json`; other formats reject it rather than silently ignoring it. **A partial slice is not self-contained** — `--only semantic` references primitives it does not itself define, so ship it alongside the primitive slice.
|
|
131
408
|
|
|
132
409
|
### Output
|
|
133
410
|
|
|
134
|
-
| Flag |
|
|
135
|
-
|
|
136
|
-
| `--format
|
|
137
|
-
| `--color-format` | `oklch` · `hex` · `rgb` · `hsl
|
|
138
|
-
| `--out <path>` |
|
|
139
|
-
| `--no-replace-palette` |
|
|
140
|
-
| `--
|
|
141
|
-
| `--
|
|
142
|
-
| `--
|
|
143
|
-
|
|
144
|
-
File names under `--format all`: `tokens.css`, `tailwind.css`, `tailwind.config.js`, `tokens.dtcg.json`, `tokens.json`.
|
|
411
|
+
| Flag | Default | What it does |
|
|
412
|
+
|---|---|---|
|
|
413
|
+
| `--format <fmt>` | `css` | See [Output formats](#output-formats). |
|
|
414
|
+
| `--color-format <fmt>` | `oklch` | `oklch` · `hex` · `rgb` · `hsl`. |
|
|
415
|
+
| `--out <path>` | stdout | File to write, or a directory when `--format all`. |
|
|
416
|
+
| `--no-replace-palette` | off | `tailwind-v4` only — keep Tailwind's stock palette. |
|
|
417
|
+
| `--merge` | off | Rewrite only the declarations this run generates into `--out`, preserving every other line. |
|
|
418
|
+
| `--no-provenance` | off | Omit the `Generated by …` header. |
|
|
419
|
+
| `--vanilla` | — | Deprecated no-op, warns. The shadcn/ui aliases it switched off no longer exist. |
|
|
420
|
+
| `--replace-palette` | — | Deprecated no-op, warns. Clearing the palette is the default; use `--no-replace-palette` to opt out. |
|
|
145
421
|
|
|
146
422
|
### Verification
|
|
147
423
|
|
|
148
424
|
| Flag | What it does |
|
|
149
425
|
|---|---|
|
|
150
|
-
| `--check` |
|
|
151
|
-
| `--report` | Print the measured contrast
|
|
152
|
-
|
|
153
|
-
`--check` replaces the regenerate-to-a-temp-dir-and-diff ritual, and reads the provenance header so it can tell three different failures apart:
|
|
426
|
+
| `--check` | Compare against what is already at `--out`. Writes nothing; exits non-zero on drift. With `--ramps` or `--merge`, only the declarations this run generates are compared. |
|
|
427
|
+
| `--report` | Print where the semantic bridge landed, peak chroma per ramp, and measured contrast for every pairing — semantic, surface and utility — with a score. Stderr only; never changes the exit code. |
|
|
154
428
|
|
|
155
429
|
```
|
|
156
|
-
|
|
157
|
-
check: tokens.css differs — generated by v0.1.6, running v0.2.0. Expected after a generator upgrade; regenerate to adopt it.
|
|
158
|
-
check: tokens.css differs — seed e06984b1 on disk, 7b5a14d2 now. The inputs changed; regenerate.
|
|
159
|
-
check: tokens.css differs — same generator and seed, so the file was edited by hand.
|
|
160
|
-
```
|
|
430
|
+
$ generate-tokens --primary "#4e9caf" --report --out tokens.css
|
|
161
431
|
|
|
162
|
-
|
|
432
|
+
semantic bridge (seed anchored at 500)
|
|
433
|
+
light default 500 subdued 50 highlight 700 ring 400
|
|
434
|
+
dark default 600 subdued 200 highlight 400 ring 700
|
|
163
435
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
436
|
+
ramp chroma (peak C per family)
|
|
437
|
+
primary 0.0815 at 500
|
|
438
|
+
grey forest 0.0247 at 500
|
|
439
|
+
note: forest carries too little chroma to read as a marking
|
|
440
|
+
at small sizes. Picking harder will not fix it; a palette can be short of a colour.
|
|
168
441
|
|
|
169
442
|
light mode (wcag, target aa)
|
|
170
443
|
AA primary/default 5.12:1
|
|
171
444
|
- neutral/default 4.30:1
|
|
172
|
-
|
|
173
|
-
|
|
445
|
+
score: 93% (14/15 pairings)
|
|
446
|
+
|
|
447
|
+
light surfaces and utilities (wcag, not counted in the score)
|
|
448
|
+
AAA canvas/foreground 13.05:1
|
|
449
|
+
- ring/canvas 1.82:1 (non-text, 1.4.11)
|
|
450
|
+
border/canvas 1.29:1 (advisory: 3:1 only where it bounds a control)
|
|
174
451
|
```
|
|
175
452
|
|
|
453
|
+
Three things worth knowing about that output. **Chroma** is reported because a seed can be chromatic by the numbers and still land as grey on the page — every candidate is a real token, nothing errors, and the result just looks weak. **Surfaces and utilities** are measured but not scored, so the score stays comparable across versions; the focus ring is held to WCAG 1.4.11's 3:1 rather than the body-text bar, and `border` is reported without a verdict because round a card it is decoration and round a text input it is the control's boundary. **Nothing here changes the exit code** — `--check` is the gate.
|
|
454
|
+
|
|
176
455
|
## Tailwind v4
|
|
177
456
|
|
|
178
|
-
On Tailwind v4 a token only becomes a usable class if it sits inside a `@theme` block under a namespace Tailwind owns
|
|
457
|
+
On Tailwind v4 a token only becomes a usable class if it sits inside a `@theme` block under a namespace Tailwind owns — variables in a plain `:root` block are just CSS and generate nothing. The `tailwind-v4` format emits a complete, self-contained theme, so there is no bridge to hand-write:
|
|
179
458
|
|
|
180
459
|
```css
|
|
181
460
|
@theme static {
|
|
182
|
-
/*
|
|
183
|
-
--color-primary-500: oklch(65.07% 0.0815 215.79);
|
|
184
|
-
|
|
185
|
-
/* Semantics — registers the utility; re-bound per mode below */
|
|
186
|
-
--color-primary: var(--primary);
|
|
461
|
+
--color-*: initial; /* clear Tailwind's stock palette */
|
|
462
|
+
--color-primary-500: oklch(65.07% 0.0815 215.79); /* primitives: real values */
|
|
463
|
+
--color-primary: var(--primary); /* semantics: registers the utility */
|
|
187
464
|
}
|
|
188
465
|
|
|
189
466
|
:root, [data-theme="light"] {
|
|
190
467
|
--primary: var(--color-primary-500);
|
|
191
|
-
--color-primary: var(--primary); /* re-bound — see below */
|
|
468
|
+
--color-primary: var(--primary); /* re-bound per mode — see below */
|
|
192
469
|
}
|
|
193
470
|
[data-theme="dark"], .dark {
|
|
194
471
|
--primary: var(--color-primary-600);
|
|
@@ -196,75 +473,81 @@ On Tailwind v4 a token only becomes a usable class if it sits inside a `@theme`
|
|
|
196
473
|
}
|
|
197
474
|
```
|
|
198
475
|
|
|
199
|
-
|
|
476
|
+
You get `bg-primary`, `text-primary-foreground`, `bg-canvas`, `border-border` **and** `bg-primary-500`, in both modes.
|
|
200
477
|
|
|
201
|
-
|
|
478
|
+
Three details carry the weight, each verified against a real Tailwind compile:
|
|
202
479
|
|
|
203
|
-
|
|
480
|
+
**`@theme static`, never plain `@theme`.** Tailwind tree-shakes a plain theme block down to only the tokens some utility references — silently, with no build error. On a default palette that drops **47 of 140** colour tokens, including every `red`/`green`/`yellow` ramp, so `bg-red-500` quietly falls back to Tailwind's stock red.
|
|
204
481
|
|
|
205
|
-
**
|
|
482
|
+
**Semantic aliases appear in the theme block *and* every mode block.** The `@theme` entry registers the name so the utility exists. But custom properties inherit their *computed* value, so an alias declared only on `:root` captures the light value and will not re-resolve inside a scoped `[data-theme="dark"]` subtree — a dark card on a light page would keep the light colour. (`<html class="dark">` works either way, being the same element, which is why this is easy to miss.)
|
|
206
483
|
|
|
207
|
-
|
|
484
|
+
**The stock palette is cleared by default.** `--color-*: initial` means any colour class the file does not define fails to compile rather than rendering off-brand. The alternative is worse than it looks: if a project does not own `--color-slate-900`, then `bg-slate-900` yields Tailwind's stock slate — off-brand, compiles cleanly, reads as deliberate in review, and survives a re-theme. Better a build error you fix.
|
|
208
485
|
|
|
209
|
-
|
|
486
|
+
Tailwind's `transparent`, `current` and `inherit` are not part of the `--color-*` namespace, so `bg-transparent` and `text-current` keep working. Pass `--no-replace-palette` when adopting this into an existing Tailwind codebase that still uses stock hues — otherwise every `bg-slate-*` stops compiling at once.
|
|
210
487
|
|
|
211
|
-
|
|
488
|
+
## Overriding what it generates
|
|
212
489
|
|
|
213
|
-
|
|
490
|
+
Every generated block is **unlayered**, and the mode blocks carry class hooks as well as attributes:
|
|
214
491
|
|
|
215
492
|
```css
|
|
216
|
-
|
|
493
|
+
:root /* primitives */
|
|
494
|
+
:root, [data-theme="light"] /* light */
|
|
495
|
+
[data-theme="dark"], .dark /* dark */
|
|
496
|
+
@media (prefers-color-scheme: dark) {
|
|
497
|
+
:root:not([data-theme="light"]):not(.light) /* system dark */
|
|
498
|
+
}
|
|
217
499
|
```
|
|
218
500
|
|
|
219
|
-
|
|
501
|
+
Two consequences, both of which have cost real projects real time:
|
|
220
502
|
|
|
221
|
-
|
|
503
|
+
**An override inside `@layer` loses**, whatever the import order — unlayered CSS beats any layer. Nothing errors; the override simply does not apply, and it reads as correct when you open the file.
|
|
222
504
|
|
|
223
|
-
|
|
505
|
+
**An unlayered override can still lose on specificity.** The system-dark selector is `(0,3,0)`; a plain `:root` is `(0,1,0)`. An override written on `:root` alone applies in light mode and silently loses in dark, which one project shipped as a warm brown ground served to every dark-mode visitor — verified as correct twice, because headless browsers default to light. Match the selector:
|
|
224
506
|
|
|
225
|
-
|
|
507
|
+
```css
|
|
508
|
+
:root,
|
|
509
|
+
:root:not([data-theme="light"]):not(.light) {
|
|
510
|
+
--canvas: var(--color-ink);
|
|
511
|
+
}
|
|
512
|
+
```
|
|
226
513
|
|
|
227
|
-
|
|
514
|
+
Then check **both** colour schemes, not whichever your tool defaults to.
|
|
228
515
|
|
|
229
|
-
|
|
230
|
-
|---|---|
|
|
231
|
-
| shadcn/ui aliases (`--background`, `--card`, `--secondary`, `--sidebar-*`, `--chart-*`) are gone | Map them yourself if you need them. Vanilla is now the only behaviour. |
|
|
232
|
-
| `--vanilla` is a no-op | Remove it. Accepted for 0.2, removed in 0.3. `ExportOptions.compat` is gone. |
|
|
233
|
-
| `--format lovable` removed | Dropped with the aliases — it was a shadcn-shaped `globals.css`. `exportToLovable` is no longer exported. |
|
|
234
|
-
| `tailwind-v4` restructured | Regenerate. The dark selector is now `[data-theme="dark"], .dark` rather than `.dark` alone, and there is now a `prefers-color-scheme` fallback matching the css export. |
|
|
235
|
-
| `tailwind-v4` primitives renamed | `--primary-500` → `--color-primary-500`, matching the css export. Update any direct references. |
|
|
236
|
-
| Output carries a provenance header | Expected. `--no-provenance` opts out. |
|
|
237
|
-
| **0.3:** `tailwind-v4` clears Tailwind's stock palette by default | Stock hues like `bg-slate-900` now fail to compile. Intended — see above. Pass `--no-replace-palette` to keep them, and `--replace-palette` is now a no-op. |
|
|
238
|
-
| A seed outside 15–98% lightness no longer inverts the ramp | Bug fix. A near-black or near-white seed was reproduced exactly at its anchor while its neighbours were clamped, so 500 could come out darker than 600. The range now widens to admit the seed; the tight side collapses onto it instead. Only affects seeds outside that range. |
|
|
516
|
+
**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.
|
|
239
517
|
|
|
240
|
-
|
|
518
|
+
Generated files carry this contract in their own header, built from the selectors that file actually emitted.
|
|
241
519
|
|
|
242
|
-
|
|
520
|
+
If you find yourself hand-writing a colour beside the generated file, that is the signal to add a seed instead — `--color name=value` gives you a full scale with contrast-paired foregrounds, and `--seed-shade` puts it on the step the semantics read. A hand-written brand layer forks the colour system in a way `--check` cannot see: it passes, while the page renders from somewhere else entirely.
|
|
243
521
|
|
|
244
|
-
|
|
245
|
-
src/ types, oklch, primitives, semantic, generate, export, seed, index (barrel), cli
|
|
246
|
-
test/ parity tests, export invariants, fixture cases, golden fixtures, fixture regenerator
|
|
247
|
-
```
|
|
522
|
+
## Guarantees
|
|
248
523
|
|
|
249
|
-
|
|
524
|
+
- **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.)
|
|
525
|
+
- **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.
|
|
526
|
+
- **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.
|
|
527
|
+
- **Two dependencies**, both pure JS: `culori` (colour maths) and `apca-w3` (APCA contrast).
|
|
528
|
+
- **ESM**, Node 18+.
|
|
250
529
|
|
|
251
|
-
##
|
|
530
|
+
## Development
|
|
252
531
|
|
|
253
|
-
|
|
254
|
-
|
|
532
|
+
Part of the [designtools](https://github.com/andflett/designtools) monorepo.
|
|
533
|
+
|
|
534
|
+
```bash
|
|
535
|
+
npx tsx packages/tokens/src/cli.ts --primary "#4e9caf" # run from source
|
|
536
|
+
npm -w packages/tokens run build # tsup -> dist
|
|
255
537
|
npm -w packages/tokens run typecheck
|
|
256
|
-
npm -w packages/tokens run
|
|
257
|
-
npm
|
|
258
|
-
npm test # parity + invariant tests run in the repo's vitest suite
|
|
538
|
+
npm -w packages/tokens run fixtures # regenerate goldens
|
|
539
|
+
npm test # vitest
|
|
259
540
|
```
|
|
260
541
|
|
|
261
|
-
|
|
542
|
+
```
|
|
543
|
+
src/ types, oklch, primitives, semantic, generate, export, seed, shades, index, cli
|
|
544
|
+
test/ fixture parity, export invariants, shade behaviour, gamut, public API
|
|
545
|
+
```
|
|
262
546
|
|
|
263
|
-
|
|
547
|
+
## Changelog
|
|
264
548
|
|
|
265
|
-
|
|
549
|
+
[CHANGELOG.md](CHANGELOG.md) — what changed in each release, and why.
|
|
266
550
|
|
|
267
|
-
|
|
268
|
-
- **Structural invariants** in `test/export-invariants.test.ts` — properties a fixture cannot assert, because a fixture only pins that bytes have not changed, and bytes can be stable and still be incoherent CSS. Chief among them: every `var(--x)` an export emits must resolve to a `--x:` the same output defines.
|
|
551
|
+
## Licence
|
|
269
552
|
|
|
270
|
-
|
|
553
|
+
CC-BY-NC-4.0
|