Repository navigation
Description
Overview
While tokenizing status colors in #2592, contrast-checking every mapping in both themes surfaced a gap in the token set itself rather than a mapping error: there is no green dark enough to use as body text on a light surface.
Problem Statement
app.css light mode defines:
--success: 97 45% 46%→ 2.83:1 against--card(0 0% 100%)--success-light: 96 64% 69%→ 1.52:1 against--card
WCAG AA requires 4.5:1 for normal-size text. Neither variant reaches it, so any success/confirmation text on a white card is below AA in light mode. Dark mode is fine (--success is 6.93:1).
This is not symmetric with the other state colors:
| Token | on --card, light |
on --card, dark |
|---|---|---|
--destructive |
4.57 ✅ | 6.17 ✅ |
--warning (on tint) |
passes ✅ | passes ✅ |
--success |
2.83 ❌ | 6.93 ✅ |
A second, related gap: --success-foreground and --destructive-foreground are both 0 0% 100% (white) in both light and dark. Pairing them with the solid mid-tone fills — the pairing the names imply is correct — yields 2.55–2.83:1. #2592 had to work around this by tinting backgrounds and using the state color as text.
Known live instance
packages/desktop-app/src/lib/components/collaboration/invitations-inbox.svelte — .ok (rendered with role="status") is hsl(var(--success)) on hsl(var(--card)) = 2.83:1 in light mode. Left as-is in #2592 because every available token alternative scored worse; documented in that commit as a known residual.
Proposed Solution
Options, roughly in order of preference:
- Add a darker success variant for text use (e.g.
--success-strong, ~30-35% lightness in light mode) and point text-context usages at it. Mirrors how--destructivealready happens to work. - Darken
--successitself in light mode to ≥4.5:1 on white. Cheapest, but changes existing fills wherever--successis a background. - Fix the
*-foregroundtokens so they carry a genuine light/dark pair instead of being white in both, making solid-fill pairings viable and removing the need for the tint workaround.
Option 3 is worth doing regardless of 1/2, since it affects --destructive/--warning badges too.
Acceptance Criteria
- Success text on a light surface meets 4.5:1 (normal text) in both themes
-
--*-foregroundtokens produce ≥4.5:1 against their paired solid fill in both themes, or are documented as fill-only with a sanctioned alternative -
.okininvitations-inbox.svelteupdated to the new token and verified - Existing
--success/--success-lightconsumers audited for regression (grep -rn "var(--success" packages/desktop-app/src) - Contrast values recorded in the PR for both themes
Technical Specifications
- Token source:
packages/desktop-app/src/app.css— light on:root, dark on.dark(class-based, not a media query) - Tokens are HSL triplets, consumed as
hsl(var(--token))/hsl(var(--token) / alpha) - Verify with a relative-luminance contrast calculation per WCAG 2.1, not by eye
Related Issues
- Replace hardcoded status colors and phantom CSS variables in diagnostic-panel and invitations-inbox with design tokens #2592 — surfaced this; contains the measured figures and the tint workaround
- Unify node-type accent colors to a single primary-based system #2590, Replace hardcoded shadows and colors in modal/toast/banner components with design tokens #2591 — same design-token audit
Activity
malibio commentedon Sep 16, 2026
Constraint: fix this with color values only
Do not add a border, outline, background fill, chip, or any other enclosure to satisfy the contrast requirement. The only lever is the color token itself — Options 1 and 2 in the description (add
--success-strong, or darken--success) are the sanctioned approaches. Option 3 (*-foregroundpairs) is fine as written since it changes token values, not surfaces.This has been added to
DESIGN.mdas a standing Don't rule:Flagging it here because the rule was previously unwritten and enclosure kept getting reintroduced — including by agents adding it unprompted on accessibility grounds. The spec also reads as if tinted backgrounds are house style (the
-lightvariants are sanctioned "for badge backgrounds", and the Card spec says tonal contrast alone is sufficient), so the pull toward a tinted box here is real.Note that #2592's tinted status-pill backgrounds are explicitly out of scope for this issue — they're being reviewed separately. Don't remove them as part of this work.
malibio commentedon Sep 16, 2026
Baseline on worktree issue-2668-state-token-contrast (branched from main @ 458a332): Frontend 246 test files / 5078 tests passed, exit 0.
Scope expansion: an audit of all four state tokens in every usage context found this is a LIGHT-MODE-ONLY problem (dark mode passes AA everywhere: success 7.04, destructive 6.27, warning 8.98, primary 5.44 on --background), but that THREE tokens fail in light mode, not just --success:
--warning 2.15 as text on white / 1.99 on a 0.1 tint (worse than --success)
--success 2.83 / 2.58
--primary 3.67 / 3.28 (AA-large only; fails for body text)
--destructive 4.57 / 3.92 (the only one genuinely OK)
--warning was missed when this issue was filed because it was written from the single --success instance encountered in #2592. Amber-on-white is the more severe offender.
Also measured: text on a 0.1 tint of its own hue is HARDER than on plain white, since the tint darkens the background in the same hue. status-bar.svelte uses exactly that pattern, so it sets the binding constraint.
Bring every state-token pairing to WCAG AA in both themes (closes #2668…