Repository navigation
Description
Overview
In light mode, --accent-foreground is a near-black 240 4% 10% sitting on --accent, which is a dark teal at 176 100% 24%. That is dark text on a dark fill: 3.40:1, below the 4.5:1 AA floor for normal text.
The dark theme gets this right — its --accent-foreground is 0 0% 98% on a 173 87% 27% fill, 4.58:1.
Why it reads as a copy/paste slip rather than a choice
Every other light-mode --*-foreground in app.css is near-white, because every light-mode semantic fill is dark:
| Token | Light fill | Light foreground | Ratio |
|---|---|---|---|
--destructive |
345 77% 46% |
0 0% 100% |
5.36:1 |
--success |
97 45% 32% |
0 0% 100% |
5.35:1 |
--warning |
38 97% 30% |
0 0% 100% |
5.26:1 |
--accent |
176 100% 24% |
240 4% 10% |
3.40:1 |
--accent-foreground is identical to --secondary-foreground (240 4% 10%), which is correct for --secondary because that fill is a near-white 240 5% 96%. It was very likely carried across from the neighbouring entry.
app.css already states the governing rule in its own comment:
--*-foregroundis the text color for a SOLID fill of the matching token. It is white here and near-black under.dark— the inverse of the usual intuition, because the light-mode fills are dark and the dark-mode fills are bright.
--accent is the one token that does not follow it.
Blast radius
hover:bg-accent hover:text-accent-foreground ships on seven sites today, and the focus work in #2718 extends the same pairing to keyboard focus on the chrome surface. Every one of them is a 3.40:1 label in light mode.
Fix
Set light --accent-foreground to 0 0% 100%, matching the other three light-mode state foregrounds. That yields 5.19:1, above AA and consistent with the stated rule.
Worth checking during implementation whether any site deliberately relies on the current near-black value — a text-accent-foreground used on a surface other than an --accent fill would flip from dark to light text.
Acceptance Criteria
- Light
--accent-foregroundclears 4.5:1 against--accent - The value follows the
--*-foregroundrule already documented inapp.css(near-white in light, near-black in dark) - Every existing
text-accent-foregroundsite is checked for a surface that is not an--accentfill -
focus-treatment.test.tshas its pinned 3.40:1 assertion and its accompanying "known gap" comment removed, since the gap is closed - The DESIGN.md note recording the gap is removed
Related
- Replace focus rings with a token shift in the chrome surface #2718 — measured the figure and pinned it in a test; that issue explicitly does not own this defect
- Shared shadcn Button variants use alpha hovers and lose contrast on hover in every variant #2689 / Add --destructive-hover / --primary-hover tokens and unify filled-button hover states #2673 — the same class of defect (a foreground token that fails on its own fill) on
--destructive
Activity
mstomar125 commentedon Sep 21, 2026
Frontend: 5226 passed (256 test files)