Repository navigation
Description
bg.dark.muted is the single cause of 15 of the 17 contrast failures that exist in dark and not in light. Fixing that one token clears all of them.
Measured with the WCAG 2.1 formula over all 320 foreground/background token pairs in packages/ui/src/tokens/colors.ts, scoring light as a control so pre-existing failures are not reported as dark-mode findings.
The 15
Every status and interaction colour fails the 3:1 that WCAG 1.4.11 requires of UI components, against this one ground:
| Ratio | Needs | Pair | Same pair in light |
|---|---|---|---|
| 2.62 | 3.0 | icon[dark].active on bg.dark.muted |
4.84 |
| 2.62 | 3.0 | icon[dark].selected on bg.dark.muted |
4.84 |
| 2.62 | 3.0 | border[dark].active on bg.dark.muted |
4.84 |
| 2.62 | 3.0 | border[dark].selected on bg.dark.muted |
4.84 |
| 2.62 | 3.0 | border[dark].focus on bg.dark.muted |
4.84 |
| 2.79 | 3.0 | fg[dark].info on bg.dark.muted |
4.54 |
| 2.79 | 3.0 | icon[dark].info on bg.dark.muted |
4.54 |
| 2.79 | 3.0 | border[dark].info on bg.dark.muted |
4.54 |
| 2.92 | 3.0 | fg[dark].success on bg.dark.muted |
4.34 |
| 2.92 | 3.0 | icon[dark].success on bg.dark.muted |
4.34 |
| 2.92 | 3.0 | border[dark].success on bg.dark.muted |
4.34 |
| 2.92 | 3.0 | fg[dark].error on bg.dark.muted |
4.33 |
| 2.92 | 3.0 | icon[dark].error on bg.dark.muted |
4.33 |
| 2.92 | 3.0 | border[dark].error on bg.dark.muted |
4.33 |
| 2.96 | 3.0 | icon[dark].warning on bg.dark.muted |
4.27 |
border[dark].focus is the one with teeth beyond aesthetics — a focus indicator below 3:1 against its adjacent ground is a WCAG 2.4.11 failure, and it is the only way a keyboard user can tell where they are.
They all pass comfortably in light, which is the tell: the ramps are fine, the ground is wrong. bg.dark.muted sits too close in luminance to the status colours that have to read against it.
Change
Darken bg.dark.muted. The warm near-black family already has darker steps to pick from, and the constraint is only that it stay distinguishable from bg.dark.subtle and bg.dark.default — the thing it exists to be is a recessed ground, so moving it away from the content colours is what it should have been doing anyway.
Re-run the audit after changing it rather than reasoning about the result; the script is in the #833 PR description and scores every pair in both themes.
packages/ui is a submodule, so this is its own PR there plus a pointer bump.
Acceptance
- All 15 pairs above reach 3:1 or better in dark
-
bg.dark.mutedis still visually distinct frombg.dark.subtleandbg.dark.default - No pair that passes today starts failing — the audit reports both directions
Note
Found by the #833 part-1 token audit. The remaining two dark-only failures are text[dark].quaternary on fg.dark.success and .error at 3.77:1 against the 4.5 needed for normal text; those are a separate shape of problem and are filed separately.
Activity
thinkclay commentedon Oct 2, 2026
Correcting this: my diagnosis was wrong.
bg.dark.mutedis not the cause, and darkening it cannot fix anything.The arithmetic rules it out. The tightest failing foreground is
#1d7282(primary[500] teal), which needs a ground luminance of ≤ 0.01303 to reach 3:1.bg.dark.subtleis already 0.0102 andbg.dark.defaultis 0.0060 — so "muted" would have to be darker than subtle to help, which inverts the ladder and destroys the thing muted exists to be. Even#241e18, close enough to subtle to be visually indistinguishable (1.06:1 apart), still only reaches 2.97.What is actually wrong
15 of the dark status tokens are byte-identical to their light counterparts. They were never inverted for dark.
fg.active/.selected#176476#3fb5c7fg.warning#a06f24#c28d41icon.active/.selected#1d7282#1d7282border.active/.selected/.focus#1d7282#1d7282fg/icon/border.info#2e72a0#2e72a0fg/icon/border.success#3a7d4c#3a7d4cfg/icon/border.error#b84f3b#b84f3bicon.warning#9a6614#9a6614The fix is already documented in the file, by whoever did half of it — the comment above
fg.dark.active:They applied that to the
fggroup's active/selected/warning and lefticonandborderbehind, plus info/success/error across all three.The actual change
Each stale token moves to the step its already-corrected sibling uses, or the 300 step where there is no corrected sibling:
#3fb5c7#7cb0d5#74b480#e58e80icon.warning#c28d41(matchesfg.dark.warning)Re-running the audit after the change: 0 dark-only failures, down from 17. That includes #952's two — lightening the success and error fills fixes dark inverse text on them as a side effect, so #952 is resolved by this change too.
No ground token is touched.
bg.dark.mutedstays as it is.Retitling to match. PR follows.
[-]bg.dark.muted fails contrast against every status colour — 15 of the 17 dark-only failures[/-][+]15 dark status tokens were never inverted — they are byte-identical to their light values[/+]fix(tokens): invert the 15 dark status tokens that were never inverted (