Skip to content

feat(theme): System-mode light/dark slots and a WCAG contrast gate - #182

Merged
zordhalo merged 2 commits into
mainfrom
feat/theme-slots-contrast
Nov 12, 2026
Merged

zordhalo merged 2 commits into
mainfrom
feat/theme-slots-contrast

Conversation

@zordhalo

Copy link
Copy Markdown
Contributor

What and why

Plan P2 (U5 + U6).

  1. Contrast gate. packages/theme/src/core/contrast.test.ts checks every theme in THEME_MANIFEST, from resolved token values: body text (foreground, foreground-body, foreground-muted) at 4.5:1 on background/background-1; foreground-{success,error,warning,info} at 3:1 on those and on their own tinted surface. A new theme missing from the test's map fails.
  2. Failures found: Light and Solarized Light failed 3:1 for success, error and info (2.70 to 2.98). Fixed in the template, not allowlisted: those three foregrounds move from step 9 to step 10. Dark, Solarized Dark and Hardstyle already passed and still do. The allowlist exists and is empty. Body text passed everywhere.
  3. System slots. New systemThemeSlots setting ({ light, dark }, default Light/Dark = today's behaviour), in the existing settings store, so no Drizzle migration. In System mode, Settings shows a "When the system is dark" select (Dark or Hardstyle). The light slot has only one candidate (Solarized is not in the app palette), so no select is shown. The pre-paint script reads a cached copy of the slots. The native window background still uses the dark/light boot colour, which Hardstyle already shared, so no regression.

Not done: colour swatches in the picker (optional).

How it was tested

  • packages/theme vitest: 134 pass. Desktop vitest on primitives/theme and settings-contributions.test.ts: pass.
  • oxfmt and oxlint on changed files; check-upstream-patches.mjs --base origin/main passes (patch 90).
  • Desktop typecheck cannot fully run here because workspace packages are unbuilt; no errors in changed files besides one implicit-any caused by the unresolved @emdash/ui module.
  • Not run: browser tests, manual UI check of the select.

Checklist

  • pnpm run check passes locally (CI runs it)
  • Every commit is signed off
  • Tests added
  • Upstream patches logged
  • Pushed with --no-verify because the pre-push suite times out under load.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ninebrains Ready Ready Preview Nov 12, 2026 8:51pm UTC
ninebrains-docs Ready Ready Preview Nov 12, 2026 8:51pm UTC

Request Review

zordhalo and others added 2 commits November 12, 2026 15:51
Body text must reach AA (4.5:1); success, error, warning and info
foregrounds must reach 3:1 on the page background and their tinted
surface. Light and Solarized Light failed for success, error and info,
so those foreground tokens move from step 9 to step 10 of their ramp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lukce <krawczakluke@gmail.com>
System mode now reads a systemThemeSlots setting ({ light, dark }, default
Light and Dark) stored in the existing settings store. Settings shows a
dark-slot select in System mode (Dark or Hardstyle). The pre-paint script
reads a cached copy so first paint matches; the native window background
stays the dark or light boot colour, which Hardstyle already shared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lukce <krawczakluke@gmail.com>
@zordhalo
zordhalo force-pushed the feat/theme-slots-contrast branch from b14c561 to 52fa039 Compare November 12, 2026 20:51
@zordhalo
zordhalo merged commit 4ff6a87 into main Nov 12, 2026
14 checks passed
@zordhalo
zordhalo deleted the feat/theme-slots-contrast branch November 12, 2026 20:56

This branch was successfully deployed

2 active deployments
Preview – ninebrains-docs — 52fa0397 Deployed Nov 12, 2026 by vercel[bot]
Preview – ninebrains — 52fa0397 Deployed Nov 12, 2026 by vercel[bot]
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.

1 participant