Skip to content

fix(theme): make the themes we author readable, and prove it - #708

Merged
EVWorth merged 2 commits into
mainfrom
fix/theme-contrast-and-focus
Sep 17, 2026
Merged

EVWorth merged 2 commits into
mainfrom
fix/theme-contrast-and-focus

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 17, 2026 •

Copy link
Copy Markdown
Owner

Wave 1 of the UI review.
Closes #700, #704, #707.

What changed, and what deliberately didn't

Themes we author — dark, light, high-contrast — are held to WCAG AA,
enforced by a test. The default light theme had the menu bar, status bar,
keyboard hints and every empty state at roughly 2.4:1.

Themes we quote — Nord, Solarized Light — keep their published values,
untouched. An earlier revision of this PR darkened them. That was wrong, and it
was wrong on a claim I hadn't checked: I asserted Solarized was misusing its own
colours, when base1 as light-mode secondary content is its documented role.

Checking properly turned up something more useful — neither theme was fully
canonical to begin with:

solarized-light   bg-tertiary  #e4ddc8   invented (Solarized has no 3rd light ground)
                  border       #d3cbb7   invented
nord              brand-700    #4c6a8f   invented

Most measured failures were against that invented third surface.

The honest position is narrower than "these palettes are broken": they cannot
meet AA and remain themselves.
On Solarized's light grounds the only canonical
members clearing 4.5:1 are its two darkest tones — every accent it defines
fails. Nord's Aurora red is 2.11:1 on Nord's own third Polar Night tone. That is
what the palettes are.

How the test handles that

Themes declare an origin. authored is held to contrast; quoted is held to
fidelity — the test asserts the values still match what the palette's author
published, because the failure mode for a quoted theme is drift. A "Solarized
Light" corrected until it passed would be a name that no longer describes its
contents.

Their real ratios are printed, not asserted:

nord:            worst pair is error on bg-tertiary at 2.11:1
solarized-light: worst pair is text-muted on bg-tertiary at 1.97:1

Nothing about this reaches the theme picker. Someone choosing Solarized can
see Solarized — the swatches are right there, and if they don't like it they
pick another one. An app that explained the contrast maths of a palette before
letting you have it would be answering a question nobody asked.

Also here

The thing that stings

The app has had contrastRatio and MIN_TEXT_CONTRAST all along, wired into
the theme editor to warn when a user's custom theme is unreadable. It was
never pointed at the five themes we ship, four of which failed. It also only
checks text-primary on bg-primary — the most forgiving pair in the set,
which the broken light theme passed at 14.68:1.

The test now uses those same helpers rather than reimplementing the maths.

Verification

🤖 Generated with Claude Code

… proves it

Four of the five built-in themes shipped with text below the WCAG AA floor.
The review only caught two of them; running the arithmetic over all five found
33 failing pairs, not 8:

    dark              0/21   already correct
    high-contrast     0/21   already correct
    nord              6/21
    light            10/21
    solarized-light  17/21

The default light theme put the menu bar, the status bar, keyboard hints and
every empty state at roughly 2.4:1 — `text-muted` on white is 2.54, and
nothing in this app is large enough to qualify for the 3:1 concession, because
the type scale runs 10px to 14px.

Every foreground moves along its own hue toward the surface it needs to escape
from, targeting ~4.9 so the values have somewhere to go before they fall back
under 4.5. For Nord and Solarized that means departing from the published
palettes. That is a real trade and it is deliberate: a theme named after a
palette is still a theme someone has to read, and both were using colours for
roles their canonical values do not survive — Solarized's `base1` as body text
on a light ground is 1.97:1.

Also here, because they are the same question:

- `brand-600` now carries white text in every theme (nord was 4.03, and
  high-contrast, of all of them, was 3.56). Primary buttons still point at
  `brand-500` in 38 places and that migration is its own change (#703) — this
  only makes a correct rung exist to migrate to.
- One focus ring for the app instead of whatever each of three webviews draws
  by default (#707), and reduced motion honoured at all (#704) — it was zero
  rules out of 2,892.
- The status bar and the update chip take their status colours from the
  semantic tokens rather than from `text-red-400` and friends. Those two were
  the least readable things in the product at 2.74 and 1.49, and they are
  where errors appear. The other 338 hardcoded colours are #706.

The test is the point. This was arithmetic over values already in the repo the
whole time, so there was never a reason for it to be a manual check — and it
was never done once. It asserts every foreground against every surface in
every built-in theme, that a brand rung can carry white text, and that a
theme's declared `base` matches how light its own surfaces are. Reverting any
single token fails it with the measured ratio in the message.

Measured in the running app: light theme went from 25 of 30 visible text
elements failing to 1, and the one left is `Run`, which is #703.

Closes #700, #704, #707.
Reverses the part of the previous commit that changed Nord's and Solarized's
colours. That was the wrong call, made on a claim I had not checked: I wrote
that both were "using colours for roles their canonical values do not survive",
and for Solarized that is simply false. `base1` as light-mode secondary content
is its documented role, straight from the palette's own table.

What checking did turn up is that neither theme was fully canonical already —
Solarized's `bg-tertiary` and `border`, and Nord's `brand-700`, are values this
project invented, because neither palette defines a third surface. Most of the
measured failures were against that invented surface.

The real position is narrower and worth stating plainly: these palettes cannot
meet WCAG AA and remain themselves. On Solarized's light grounds the only
canonical members clearing 4.5:1 are its two darkest tones, so every accent it
defines fails. Nord's Aurora red is 2.11:1 on Nord's own third Polar Night
tone. That is what the palettes are, not a mistake in them.

So themes now declare where their colours come from. `authored` is ours and is
held to AA. `quoted` reproduces a published palette and is held to fidelity
instead: the test asserts the values still match what the palette's author
published, because the failure mode for a quoted theme is drift, and a
"Solarized Light" corrected until it passed would be a name that no longer
describes its contents. Their worst ratios are printed rather than asserted, so
the cost stays in front of whoever reads the file.

Nothing about this reaches the theme picker. Someone choosing Solarized can see
Solarized — the swatches are right there, and if they don't like it they pick
another one. An app that explained the contrast maths of a palette before
letting you have it would be answering a question nobody asked.

Two things fell out of this:

- The app has had `contrastRatio` and `MIN_TEXT_CONTRAST` all along, wired
  into the theme editor to warn when a *user's* custom theme is unreadable. It
  was never once pointed at the five themes we ship, four of which failed. It
  also only checks `text-primary` on `bg-primary` — the most forgiving pair in
  the set, which the broken light theme passed at 14.68:1.
- The test now uses those same helpers instead of reimplementing the maths, so
  it asserts against the function the UI already trusts.
@EVWorth EVWorth changed the title fix(theme): make every built-in theme readable, and add the test that proves it fix(theme): make the themes we author readable, and prove it Sep 17, 2026
@EVWorth
EVWorth merged commit 6fa7abc into main Sep 17, 2026
12 checks passed
@EVWorth
EVWorth deleted the fix/theme-contrast-and-focus branch September 17, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P1][a11y] Light theme fails WCAG AA on three of its seven foreground tokens, on every surface

1 participant