Repository navigation
fix(theme): polish Matrix + HAL 9000 (and other dark) presets to WCAG AA - #4897
Conversation
Option A (polish, not removal): keep every theme + variant id so persisted selections still resolve, and raise the weak dark palettes to the AA bar. - HAL 9000: deepen resting primary (230 40 40 -> 214 30 30) so the white button label clears 4.5:1 (was 4.47); accent text keeps the lighter 300/400 shades so the glowing-red identity holds. - Matrix: nudge content-faint up so faint/placeholder text clears 3:1 on the brighter hover/strong green surfaces (was ~2.6:1). - Ocean Dark / Sepia Dark: brighten content-muted (>=4.5) and content-faint (>=3) so they hold on the lighter elevated surfaces, and set a dark content-inverted so labels over the light-blue / tan primary fills clear AA (white was ~2.5-2.6:1) — matching the pattern Matrix already uses for green. Add channelContrast() helper + presets.contrast.test.ts, a WCAG AA gate over every shipped dark preset: body/muted text >=4.5:1 and faint text >=3:1 across all surface states, primary button label >=4.5:1 on its resting/active fills, accent text >=4.5:1, and primary-500 >=3:1 as a UI element.
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a WCAG contrast helper, updates selected dark theme tokens, and introduces automated checks covering contrast requirements across all built-in dark presets. ChangesDark theme contrast compliance
Estimated code review effort: 3 (Moderate) | ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/src/lib/theme/presets.contrast.test.ts`:
- Around line 10-35: Eliminate the duplicated dark token values in DARK_BASE by
exposing a shared dark-defaults source used by both runtime theme resolution and
this test. Update the test to consume that shared export, or add an automated
parity check against tokens.css, while preserving the existing merged-theme
behavior.
- Around line 40-48: Expand the contrast test matrix around SURFACES and its
related assertions to include the documented surface-overlay state, primary-400
for hover button labels alongside the existing primary-500/600 checks, and every
relevant surface rather than only surface. Ensure all runtime states documented
in presets.ts are validated for both button-label and UI-element contrast
requirements.
- Around line 37-39: Update the contrast assertions for content-faint in the
relevant test section to require the AA_TEXT threshold of 4.5:1, rather than
AA_LARGE at 3:1. Keep AA_LARGE available only for separately identified exempt
tokens or tests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: feb33575-cfbc-4113-94b5-df55b7ac727d
📒 Files selected for processing (4)
app/src/lib/theme/color.test.tsapp/src/lib/theme/color.tsapp/src/lib/theme/presets.contrast.test.tsapp/src/lib/theme/presets.ts
- Format presets.contrast.test.ts (Prettier). - DARK_BASE single-source-of-truth: add a parity test that parses tokens.css (`:root` overlaid by `:root.dark`) and fails if the JS mirror drifts from the CSS, so a token edit can't leave the gate green while runtime colours change. - Expand the gate: include `surface-overlay` in the surface matrix and hold the primary-500 UI-element ratio (>=3:1) on every surface, not just `surface`. - Document why the transient dark hover fill (dark:hover:bg-primary-400) is not gated: it lightens the fill app-wide (even the untouched `dark` preset sits at ~2.5:1 white-on-primary-400), so it's a Button behaviour, not a token. - Correct the HAL primary-500 comment (active fill primary-600 clears AA; drop the inaccurate claim about the hover shade).
Pushed 5f8350b — Prettier fix + CodeRabbit review addressedCI (Frontend Checks / Prettier) CodeRabbit review (3 actionable):
No product-code palette values changed in this push beyond the earlier polish; changes here are test coverage + a doc-comment correction. All dark presets still clear AA under the (now stricter) gate. Option A (polish, not removal) unchanged — every theme + variant id preserved. |
… AA (tinyhumansai#4897) Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
Closes #4811
Summary
Take Option A (polish, not removal): keep every theme + variant id so persisted selections still resolve, and raise the weak dark palettes to the WCAG AA bar.
Changes
230 40 40→214 30 30) so the white button label clears 4.5:1 (was 4.47); accent text keeps the lighter 300/400 shades so the glowing-red identity holds.channelContrast()helper +presets.contrast.test.ts: a WCAG AA gate over every shipped dark preset (body/muted ≥4.5:1, faint ≥3:1 across surface states, button label ≥4.5:1, accent ≥4.5:1, primary-500 ≥3:1 as UI).Verification
pnpm typecheck: changed files clean.Notes
Summary by CodeRabbit