You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Overriding one side of a colour pair silently voids the contrast guarantee #5014
expandColorScale guarantees text at ≥4.5:1 and --color-border-emphasized at ≥3:1 against the surfaces it generates, for any accent. The guarantee is real — and it is silently void for any pair where the author writes one side by hand in tokens. Nothing warns, and the loss is invisible until someone measures the rendered pixels.
Measured on six independently authored themes (same brief set, two authoring aids):
A theme that hand-tuned its accent for dark mode:
color: {accent: '#0064E0',neutralStyle: 'warm',contrast: 'high'},tokens: {'--color-accent': ['#0064E0','#1E6FE0'],// no --color-on-accent}
The scale generated --color-on-accent: #002D80 for the original accent. The rendered primary button in dark mode:
light
dark
this theme
5.39:1
2.61:1
a sibling theme that changed nothing
6.46:1
7.34:1
Read off the real DOM (getComputedStyle on core-button--primary), not off the tokens. The author had run their own contrast math on the accent — against white, which is not what the theme renders. This one was a medication-administration UI, and the fix is one token.
Same pattern on borders: all three themes that hand-wrote --color-border-emphasized landed below 3:1 (1.46, 1.58, 1.66–1.86); the themes that left neutrals to color: {} stayed above it.
Options, roughly in order of how much I like them:
Warn at build.astryx theme build already resolves every token for both modes. It could check the pairs it knows about — on-accent/accent, on-error/error, on-warning/warning, on-success/success, text/surface, border-emphasized/surface — and warn below threshold. It knows which side was authored, so the message can name the missing counterpart.
Derive the on-* token from an authored base colour instead of leaving the generated one behind, unless it too was authored.
Document it where authors are looking: the color config docstring says what it generates but not that overriding one side of a pair drops the guarantee.
(1) and (3) at minimum. Happy to take (1) if there is agreement on the pair list and on warn-vs-error.
Fix in #5281 — astryx theme build now measures ten pairs in both modes and names the token you forgot.
Scoped to pairs where the theme hand-wrote exactly one side, which is this issue as filed. I built the wider version first (any failing pair with either side authored) and it warns on all seven bundled themes; stone shows why that reading is not safe yet, so the token-semantics question is split out to #5282. Both-sides-authored becomes checkable once that is settled.
It also caught a real 2.94:1 control boundary in the shipped theme.template.ts — fixed in the same PR.
Activity
cixzhang commentedon Aug 21, 2026
Fix in #5281 —
astryx theme buildnow measures ten pairs in both modes and names the token you forgot.Scoped to pairs where the theme hand-wrote exactly one side, which is this issue as filed. I built the wider version first (any failing pair with either side authored) and it warns on all seven bundled themes; stone shows why that reading is not safe yet, so the token-semantics question is split out to #5282. Both-sides-authored becomes checkable once that is settled.
It also caught a real 2.94:1 control boundary in the shipped
theme.template.ts— fixed in the same PR.fix(cli): warn when a theme overrides one side of a colour pair
fix(cli): warn when a theme overrides one side of a colour pair
fix(cli): warn when a theme overrides one side of a colour pair
fix(cli): warn when a theme overrides one side of a colour pair