<!-- generated by scripts/gen-docs.mjs from docs/system/colors.md. Edit the source and rerun. -->
# Colors

## Description

Greys and one accent colour. The page is a light cool grey, and surfaces on it are white. Text is near-black. One grey fills every flat control. The accent is one hue, set in one place. Other colours appear only where they carry a named meaning, such as good and bad data, a warning, a destructive action, a file's kind or a chart's series. A tooltip uses its own dark grey, `--tip`, in both themes.

## Tokens

<!-- tokens:start color -->
| Token | Light | Dark | Role |
|---|---|---|---|
| `--background` | `oklch(0.976 0.003 264)` | `oklch(0.145 0 0)` | The page: a faintly cool off-white |
| `--foreground` | `oklch(0.145 0 0)` | `oklch(0.985 0 0)` | Text, and the fill of a toggle, pill or chip that is on |
| `--card` | `oklch(1 0 0)` | `oklch(0.205 0 0)` | A white surface on the page, with no border and no shadow |
| `--card-foreground` | `var(--foreground)` | same | Text on a card |
| `--popover` | `oklch(1 0 0)` | `oklch(0.205 0 0)` | A floating surface: popover, menu, sheet, toast |
| `--popover-foreground` | `var(--foreground)` | same | Text on a floating surface |
| `--muted` | `oklch(0.948 0.004 264)` | `oklch(0.269 0 0)` | The grey fill: a pill or chip that is off, a segmented control's or tabs' track, a row under the pointer |
| `--thumb` | `var(--card)` | `oklch(0.37 0 0)` | The selection that slides in a grey track: a segmented control's, the active tab's, the nav's. Always lighter than the track |
| `--muted-foreground` | `oklch(0.5 0 0)` | `oklch(0.708 0 0)` | Secondary text; 5.5:1 on --muted, 4.7:1 on --border |
| `--secondary` | `var(--muted)` | same | The secondary button's fill, the same grey |
| `--secondary-foreground` | `oklch(0.205 0 0)` | `oklch(0.985 0 0)` | Text on the secondary fill |
| `--accent` | `var(--muted)` | same | A menu, select or list row under the pointer or the arrow keys, the same grey |
| `--accent-foreground` | `oklch(0.205 0 0)` | `oklch(0.985 0 0)` | Text on the hover fill |
| `--border` | `oklch(0.915 0.004 264)` | `oklch(1 0 0 / 10%)` | A 1px line, used where spacing cannot separate two things |
| `--input` | `var(--border)` | `oklch(1 0 0 / 15%)` | A field's fill, drawn at half opacity |
| `--ring` | `oklch(0.145 0 0 / 70%)` | `oklch(0.985 0 0 / 70%)` | Keyboard focus: a thin neutral outline on every control but a text field, which draws the accent edge (D40) |
| `--hover` | `oklch(0.145 0 0 / 5%)` | `oklch(1 0 0 / 6%)` | A tint on whatever is under the pointer, and the press tint `pressable` draws |
| `--scrim` | `oklch(0 0 0 / 20%)` | `oklch(0 0 0 / 50%)` | The page behind a dialog or sheet |
| `--tip` | `oklch(0.18 0 0)` | `oklch(0.27 0 0)` | A tooltip's fill, dark in both themes; every chart swatch holds 3:1 on it |
| `--tip-foreground` | `oklch(0.985 0 0)` | same | Text on a tooltip |
| `--primary` | `oklch(0.5 0.12 262)` | `oklch(0.72 0.11 262)` | The accent colour as a fill: the primary button, a checked checkbox, radio or switch, a picked calendar day, a progress bar |
| `--primary-foreground` | `oklch(1 0 0)` | `oklch(0.18 0.03 262)` | Text on the accent |
| `--primary-ink` | `var(--primary)` | `oklch(0.76 0.1 262)` | The accent as text and as a small mark: a link, the check on a chosen menu or select row, today in a calendar |
| `--primary-soft` | `color-mix(in oklab, var(--primary) 9%, transparent)` | `color-mix(in oklab, var(--primary) 14%, transparent)` | A light accent tint behind a selected list or table row, a calendar range's band and an info alert, from the accent |
| `--primary-hover` | `color-mix(in oklab, var(--primary), oklch(0 0 0) 10%)` | same | The accent fill under the pointer |
| `--secondary-hover` | `color-mix(in oklch, var(--secondary), var(--foreground) 5%)` | same | A grey fill under the pointer: a secondary button, a pill or chip that is off |
| `--muted-hover` | `var(--secondary-hover)` | same | The same step for the muted fill |
| `--destructive` | `oklch(0.49 0.245 27.325)` | `oklch(0.704 0.191 22.216)` | An action that removes something, an error and an invalid field: red text on a light red wash, 4.7:1 on that wash over the page |
| `--good` | `oklch(0.48 0.14 152)` | `oklch(0.76 0.13 152)` | Data that went the right way: up, matched, verified; 4.5:1 on its own soft chip |
| `--bad` | `oklch(0.53 0.17 27)` | `oklch(0.72 0.15 27)` | Data that went the wrong way: down, failed, overdue |
| `--warning` | `oklch(0.5 0.11 70)` | `oklch(0.83 0.12 80)` | Text that warns: a limit near, a sync behind |
| `--warning-soft` | `oklch(0.95 0.05 85)` | `oklch(0.3 0.06 75)` | The fill behind a warning |
| `--bubble` | `var(--muted)` | same | A message from someone else |
| `--bubble-foreground` | `var(--foreground)` | same | Text in their bubble |
| `--bubble-mine` | `var(--foreground)` | same | A message you sent |
| `--bubble-mine-foreground` | `var(--background)` | same | Text in your bubble |
| `--sidebar` | `var(--background)` | same | A stock shadcn sidebar's fill: the page |
| `--sidebar-foreground` | `var(--foreground)` | same | Text in a stock shadcn sidebar |
| `--sidebar-primary` | `var(--primary)` | same | A stock shadcn sidebar's accent |
| `--sidebar-primary-foreground` | `var(--primary-foreground)` | same | Text on that accent |
| `--sidebar-accent` | `var(--muted)` | same | A stock shadcn sidebar row under the pointer |
| `--sidebar-accent-foreground` | `var(--foreground)` | same | Text on that row |
| `--sidebar-border` | `var(--border)` | same | A stock shadcn sidebar's lines |
| `--sidebar-ring` | `var(--ring)` | same | A stock shadcn sidebar's focus |
| `--file-other` | `oklch(0.606 0.016 264)` | same | A file icon's sheet: a file of no known kind. The file kinds are the same in both themes |
| `--file-document` | `oklch(0.603 0.176 260)` | same | A file icon's sheet: a text document |
| `--file-spreadsheet` | `oklch(0.628 0.142 155)` | same | A file icon's sheet: a spreadsheet |
| `--file-presentation` | `oklch(0.692 0.156 47)` | same | A file icon's sheet: a slide deck |
| `--file-pdf` | `oklch(0.612 0.193 27)` | same | A file icon's sheet: a PDF |
| `--file-image` | `oklch(0.611 0.2 302)` | same | A file icon's sheet: an image |
| `--file-code` | `oklch(0.504 0.043 260)` | same | A file icon's sheet: source code |
| `--file-archive` | `oklch(0.704 0.13 81)` | same | A file icon's sheet: an archive |
| `--file-audio` | `oklch(0.622 0.19 356)` | same | A file icon's sheet: audio |
| `--file-video` | `oklch(0.563 0.198 276)` | same | A file icon's sheet: video |
| `--file-ink` | `var(--on-photo)` | same | The white mark drawn on a file icon's coloured sheet |
<!-- tokens:end color -->

### Hues

A tag takes its colour from a hue angle set on the element (`--h`), so one scheme colours every kind of item. Grey is `--c: 0`.
<!-- tokens:start hue -->
| Token | Light | Dark | Role |
|---|---|---|---|
| `--hue-bg` | `oklch(0.95 calc(var(--c, 1) * 0.035) var(--h, 0))` | `oklch(0.3 calc(var(--c, 1) * 0.05) var(--h, 0))` | A tag's fill from --h, grey when --c is 0 |
| `--hue-bg-hover` | `oklch(0.925 calc(var(--c, 1) * 0.045) var(--h, 0))` | `oklch(0.34 calc(var(--c, 1) * 0.055) var(--h, 0))` | The same fill under the pointer |
| `--hue-fg` | `oklch(0.42 calc(var(--c, 1) * 0.11) var(--h, 0))` | `oklch(0.87 calc(var(--c, 1) * 0.08) var(--h, 0))` | A tag's text from --h |
<!-- tokens:end hue -->

### Charts

A chart series takes its colour from these six, in order, and never from a hue of its own. The order is the safeguard: each neighbour pair stays apart for the two common forms of colour blindness, and every series holds 3:1 against a card in both themes. A comparison series, such as the same period a year before, is the grey `--chart-previous`, always dashed, so colour is never its only cue.
<!-- tokens:start chart -->
| Token | Light | Dark | Role |
|---|---|---|---|
| `--chart-1` | `var(--primary)` | `var(--primary)` | The first series: the accent |
| `--chart-2` | `oklch(0.62 0.11 185)` | `oklch(0.62 0.105 185)` | The second series: teal |
| `--chart-3` | `oklch(0.6 0.15 55)` | `oklch(0.74 0.14 55)` | The third series: orange |
| `--chart-4` | `oklch(0.55 0.17 300)` | `oklch(0.72 0.15 300)` | The fourth series: violet |
| `--chart-5` | `oklch(0.65 0.13 80)` | `oklch(0.8 0.14 80)` | The fifth series: amber |
| `--chart-6` | `oklch(0.55 0.17 345)` | `oklch(0.7 0.15 345)` | The sixth series: magenta |
| `--chart-spare` | `oklch(0.55 0.15 262)` | `oklch(0.72 0.11 262)` | A blue no fixed series uses: an accent preset whose hue sits near a series points that series here, so no two series share a colour |
| `--chart-previous` | `oklch(0.64 0 0)` | `oklch(0.55 0 0)` | A comparison series, such as the year before, always dashed; 3.4:1 on --card |
| `--chart-grid` | `color-mix(in oklch, var(--border) 70%, transparent)` | `color-mix(in oklch, var(--border) 70%, transparent)` | Gridlines behind the marks |
<!-- tokens:end chart -->

## Specimens

The showcase draws one swatch per role on the surface it sits on: ink and muted text on the page and on a card, the grey fill with its text, the accent as a fill and as ink, good and bad as text, and a tag at six hues beside a grey one, in both themes.

## Usage

| When                                              | Use                                           |
| ------------------------------------------------- | --------------------------------------------- |
| The page behind everything                        | `bg-background`                               |
| A card, a row, a sheet, a menu                    | `bg-card` or `bg-popover`, with no border     |
| A pill, chip, tab or secondary button that is off | `bg-muted text-foreground`                    |
| The same control, on                              | `bg-foreground text-background`               |
| The one primary action of a view                  | `bg-primary text-primary-foreground`          |
| A link, a selected label, a highlighted word      | `text-primary-ink`                            |
| A number that went up or down                     | `text-good` or `text-bad`                     |
| Something being removed                           | `text-destructive` on a light red wash        |
| A label coloured by what it names                 | `Tag` with a hue                              |
| A tooltip                                         | `bg-(--tip) text-(--tip-foreground)`          |

- `rule/colors-tokens-only`: When a component or page sets a colour, use a token utility (`bg-muted`, `text-primary-ink`), because a raw value keeps its light colour in the dark theme and a palette class has no stated job. Evidence: app 2/2 source apps define every colour as a custom property (tsaglobal app.css `:root`, adv-atlas tokens.css `:root`); principle heuristic: consistency and standards. Check: lint rule/raw-value and rule/palette-use (scripts/check-system.mjs).
  - Don't: `<div className="bg-[#f4f4f5] text-gray-500">`
  - Do: `<div className="bg-muted text-muted-foreground">`
- `rule/colors-one-accent`: When a view has more than one primary action, give one the accent fill and make the rest `variant="secondary"`, because the accent shows you the next step at a glance, and a page with the accent everywhere has no primary action left. Evidence: person D13; app 1/52 secondary against 1 default Button in tsaglobal product code (survey 2026-10-16). Check: review on the showcase at 390 and 1280.
  - Don't: `<Button>Save</Button> <Button>Publish</Button>`
  - Do: `<Button variant="secondary">Save</Button> <Button>Publish</Button>`
- `rule/colors-selection-is-neutral`: When a control shows that it is selected, fill it with ink (`bg-foreground text-background`) through `pillClasses` or the Pill component, because an accent-coloured selection reads as an error or a call to act. Evidence: person D13; app 2/2 source apps fill a selected pill with ink (tsaglobal components/pill.tsx, adv-atlas web/css/controls.css). Check: review of every selected state in the showcase.
  - Don't: `<button className="bg-primary text-primary-foreground" aria-pressed>Events</button>`
  - Do: `<Pill pressed>Events</Pill>`
- `rule/colors-destructive-is-written`: When an action removes something, show it as text in `text-destructive` on a flat or grey fill instead of a red fill, because the word already says what will happen, and a red fill pulls the eye on every screen it sits on. Evidence: app 12/12 destructive Buttons in tsaglobal use `bg-destructive/10 text-destructive` (survey 2026-10-16). Check: lint rule/component-override on Button; review.
  - Don't: `<Button className="bg-destructive text-white">Delete</Button>`
  - Do: `<Button variant="destructive">Delete event</Button>`
- `rule/colors-hue-from-content`: When a tag, avatar or marker needs a colour that tells one thing from another, set `--h` through `hueStyle(hueFor(key))` and let `--hue-bg` and `--hue-fg` derive the fill and text, because a hand-picked colour per kind drifts and a hash keeps the same key the same colour everywhere. Evidence: single use docs/research/2026-10-16-findings.md:67, the one scheme colours tags, avatars and event icons alike in the second source app; principle heuristic: consistency and standards, the same key gets the same colour everywhere. Check: lint rule/raw-value; review.
  - Don't: `<span className="bg-[oklch(0.95_0.04_200)] text-[oklch(0.42_0.11_200)]">Equity</span>`
  - Do: `<Tag hue={hueFor("equity")}>Equity</Tag>`
- `rule/colors-no-gradient`: When a surface needs depth or emphasis, use spacing, the grey fill `bg-muted` or `shadow-floating` instead of a gradient, because a gradient competes with the content, and decision D11 bans it. Evidence: person D11; principle heuristic: aesthetic and minimalist design, a gradient competes with content. Check: lint rule/ban-gradient (scripts/check-system.mjs).
  - Don't: `<div className="bg-linear-to-br from-primary to-primary-soft">`
  - Do: `<div className="bg-card">`

## Accessibility

Text contrast, measured on the rendered showcase with the capture script's probes (`.design-system/review/*.probe.json`, 54 surfaces at 390 and 1280, both themes, 2026-10-16):

| Text                                          | Light   | Dark    |
| --------------------------------------------- | ------- | ------- |
| ink (`--foreground`) on the page              | 18.47:1 | 14.50:1 |
| muted text (`--muted-foreground`) on the page | 5.17:1  | 5.86:1  |
| accent as text (`--primary-ink`) on the page  | 5.66:1  | 9.15:1  |

Tooltip text (`--tip-foreground` on `--tip`) is 16.6:1 in light and 12.2:1 in dark, computed from the oklch lightness of the two tokens, not measured on the page.

No text under 4.5:1 was found except one probe reading of a segmented control's active label, which the probe measured against the grey track instead of the ink pill that sits between them; on the pill the pair is the inverse of ink on the page. The source app's own measurements on the same tokens: `--muted-foreground` 5.5:1 on `--muted`, 4.7:1 on `--border`; `--destructive` as text 3.98:1 on its own 10 percent wash, which is why destructive is written at `text-sm font-medium` and never smaller. Non-text contrast of the hairline and the focus ring: NEEDS REVIEW with a non-text measurement in phase 6. Colour is never the only signal: a status carries a word, a selected control carries `aria-pressed`, `aria-checked` or `aria-current`, an invalid field carries text. Each theme sets `color-scheme`, so native controls and scrollbars match it.

## Not tokens

- The alpha steps on `--hover`, `--scrim`, `--ring` and `--edge` are part of the token, not separate tokens.
- `oklch(0 0 0)` and `oklch(1 0 0)` inside `color-mix()` in tokens.css are the mixing anchors, not colours a component may use.
- A heatmap's steps are mixes of `--chart-1` into `--muted`, computed by the chart, not tokens of their own.
