feat: Chart colors that pass contrast in light and dark, with a test
Back to our planProblem
In plain words: the colors we plan to use for charts are too faint on our backgrounds in places, so some parts of a chart would be hard to see. We need six checked colors that read in light and dark mode before any chart ships.
Summary of the owner's feedback (2026-11-03, Claude in Chrome side panel, text) on the first version of the 2027 budget post: the title is too long and the explanation under it is confusing; the amounts are not grouped in consistent categories, and they don't show how much of the total each one makes up or how this year compares with last year; the icons sit above the text, and the subheader could share a line with the icon. Most importantly, there are not enough visual cues for anyone to follow what is going on, so more diagram elements, charts, infographics and other UI elements are needed, with inventive, unconventional thinking, as if written by someone on a small marketing project who knows nothing about taxes. Design spec and numbers: see #645 and the epic #589.
Today (checked 2026-11-03): chart-1 to chart-5 exist in src/themes/default/theme.css and fail contrast: light chart-2 is 2.30:1 on the background, light chart-3 and chart-4 are about 2.9:1 on the surface, dark chart-5 is 3.15:1 on the surface. themes.test.ts checks no chart pair. No page uses them yet.
Proposed fix
- Replace
chart-1…chart-5and addchart-6(also insrc/platform/theme/tokens.ts). Checked with the dataviz skill's validator; slots must be used in order (adjacent pairs are only clean that way).
| Token | Light | Dark |
|---|---|---|
| chart-1 green | #14805a | #2f9e74 |
| chart-2 blue | #2b6cc4 | #4a8ad8 |
| chart-3 orange | #c4581c | #d0692c |
| chart-4 violet | #6a55c9 | #8a7be0 |
| chart-5 gold | #8f6a00 | #b48f12 |
| chart-6 magenta | #b4457e | #d0679d |
- Add
CHART_PAIRStotokens.ts: each chart token against background, surface and card, at 3:1, in both modes.themes.test.tschecks them. - Text never sits on a colored mark; values and labels use the text tokens (documented in
nextjs-tailwind.md). - No red or green is used to show up or down (neutrality rule,
brand-voice.md). - Native first: theme tokens already are the mechanism; nothing to add. Watch out: theme token values change; no page uses
chart-*today.
Acceptance criteria
- Not done: The six values above are in
theme.cssandtokens.ts;themes.test.tsfails if any chart token drops under 3:1 against background, surface or card in light or dark. - Not done: The validator's output is pasted in the PR.
- Not done: Both light and dark checked in the gallery (swatches at 320 and 1280).
Area
styling, visualization
Priority
high
Generated by Claude Code, opens in a new tab