test(web): cover every primary wash in the contrast guard #485

Merged
Claude-Run merged 2 commits from fix/BUNYIP-485-primary-text-token into main 2026-08-06 04:38:04 +02:00
Member

The guard only composited a 10% --primary wash onto each surface, but the views also paint 5%, 18% and 20% washes under text-primary-text: the dashboard provisioning spinner sits on from-primary/20 to-primary/5, the admin empty-catalog panel on bg-primary/5, and the feedback launcher's gradient on from-primary/18. Assert AA against every alpha actually used, plus the bare surface.

#BUNYIP-485

The guard only composited a 10% `--primary` wash onto each surface, but the views also paint 5%, 18% and 20% washes under `text-primary-text`: the dashboard provisioning spinner sits on `from-primary/20 to-primary/5`, the admin empty-catalog panel on `bg-primary/5`, and the feedback launcher's gradient on `from-primary/18`. Assert AA against every alpha actually used, plus the bare surface. #BUNYIP-485
`text-primary` resolved to the static reed-700 `#2f4e2e` in every theme (the `@theme` block defines `--color-primary` as a literal hex, not `hsl(var(--primary))`), so used as a foreground it measured 1.64:1 on the dark card and 2.09:1 on the dark high-contrast card. That is what made "Sign in", "Sign up" and "Forgot password?" nearly unreadable on the dark auth cards, and it dimmed the `bg-primary/10` icon bubbles to roughly the surface luminance.

Add `--primary-text` alongside `--primary` / `--primary-foreground` in all four theme blocks, expose it as `--color-primary-text` in the `@theme` block, and repoint all 45 foreground uses of `text-primary` at `text-primary-text`. This mirrors the `--destructive` / `--destructive-text` split already in the file. The fill roles (`bg-primary`, `border-primary`, `from-primary`, `shadow-primary/10`, `text-primary-foreground`) are untouched, so filled buttons render identically.

Measured in headless Chromium against the rendered page, link on card: light 9.46:1, dark 6.94:1, light high-contrast 21.00:1, dark high-contrast 9.76:1. Icon-bubble glyph against its alpha-composited fill: 8.02 / 6.65 / 17.80 / 9.39:1. The blurred feedback launcher over a card backdrop: 7.79 / 6.01 / 17.77 / 8.65:1.

Two tests in `views/ui.rs` keep it that way: one parses the four theme blocks out of `input.css` and asserts `--primary-text` clears 4.5:1 against `--card`, `--background` and `--muted` (plus each of those under a 10% `--primary` wash), the other scans every view source and fails if the suffix-less utility reappears.

#BUNYIP-485
test(web): cover every primary wash in the contrast guard
All checks were successful
E2E PR gate / E2E / PR gate (pull_request) Successful in 23s
Check / fmt + clippy + build + tests (pull_request) Successful in 4m40s
Create release / Create release from merged PR (pull_request) Has been skipped
c96bfcce41
The guard only composited a 10% `--primary` wash onto each surface, but the views also paint 5%, 18% and 20% washes under `text-primary-text`: the dashboard provisioning spinner sits on `from-primary/20 to-primary/5`, the admin empty-catalog panel on `bg-primary/5`, and the feedback launcher's gradient on `from-primary/18`. Assert AA against every alpha actually used, plus the bare surface.

#BUNYIP-485
Claude-Run deleted branch fix/BUNYIP-485-primary-text-token 2026-08-06 04:38:04 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/bunyip!485
No description provided.