Public: anyone can read this; the crew can change it.

Dark mode: every text and accent token pair meets 4.5:1, enforced in design-lint #13018

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

bun scripts/design-lint.ts now computes contrast for every text and accent token pair in all six themes and names each failing pair. It was green after the change. I did not take the before/after pictures at 390 and 1280 px, light and dark, so that checklist item is still open.

Notes

shipped production is serving it deploy 59903fa

opened this

bun scripts/design-lint.ts now computes contrast for every text and accent token pair in all six themes and names each failing pair. It was green after the change. I did not take the before/after pictures at 390 and 1280 px, light and dark, so that checklist item is still open.

Checked pairs. These are listed in src/design/contrast.ts, using the WCAG 2.x relative-luminance formula against a 4.5:1 minimum:

  • fg on bg, card and muted
  • muted-fg on bg, card and muted
  • accent on bg and card
  • accent-fg on accent
  • primary-fg on primary

A failure prints one line, for example theme dawn: --muted-fg #797593 on --bg #faf4ed is 4.02:1, below 4.5:1.

What failed and what I changed. All three dark themes already passed. Six pairs failed, all muted-fg in the light themes. I darkened muted-fg in those three palettes (src/design/themes.ts), and every pair now passes:

Thememuted-fg beforemuted-fg afterWorst pair before
Porcelain#6b7280#646b784.40:1 on muted
Paper#6f6e69#625f5a4.01:1 on muted
Dawn#797593#625e7c3.67:1 on muted

Muted text in those three light themes is slightly darker; no other token moved.

Tests. test/contrast.test.ts checks the formula against hand values (black on white is 21:1, #767676 on white is 4.54:1). It asserts every theme passes, and that a failing pair is named with its theme, tokens and ratio.

Checks run.

  • bun x tsc --noEmit and the contrast and design-lint tests pass.
  • I did not run test/mcp-size.test.ts, since nothing here touches the MCP.
  • I ran scripts/gate.ts but only saw the tail of its output, so I can't confirm it passed.

Left out. I did not add contrast checks for the diff or syntax-highlighting tokens, or for the faint text token. There are no dependencies and no MCP or terminal surface; the check runs wherever design-lint runs.

Closes #13008

2 earlier comments · 1 event
commented

bun scripts/design-lint.ts now computes contrast for every text and accent token pair in all six themes and names each failing pair. It was green after the change. I did not take the before/after pictures at 390 and 1280 px, light and dark, so that checklist item is still open.

Checked pairs. These are listed in src/design/contrast.ts, using the WCAG 2.x relative-luminance formula against a 4.5:1 minimum:

  • fg on bg, card and muted
  • muted-fg on bg, card and muted
  • accent on bg and card
  • accent-fg on accent
  • primary-fg on primary

A failure prints one line, for example theme dawn: --muted-fg #797593 on --bg #faf4ed is 4.02:1, below 4.5:1.

What failed and what I changed. All three dark themes already passed. Six pairs failed, all muted-fg in the light themes. I darkened muted-fg in those three palettes (src/design/themes.ts), and every pair now passes:

Thememuted-fg beforemuted-fg afterWorst pair before
Porcelain#6b7280#646b784.40:1 on muted
Paper#6f6e69#625f5a4.01:1 on muted
Dawn#797593#625e7c3.67:1 on muted

Muted text in those three light themes is slightly darker; no other token moved.

Tests. test/contrast.test.ts checks the formula against hand values (black on white is 21:1, #767676 on white is 4.54:1). It asserts every theme passes, and that a failing pair is named with its theme, tokens and ratio.

Checks run.

  • bun x tsc --noEmit and the contrast and design-lint tests pass.
  • I did not run test/mcp-size.test.ts, since nothing here touches the MCP.
  • I ran scripts/gate.ts but only saw the tail of its output, so I can't confirm it passed.

Left out. I did not add contrast checks for the diff or syntax-highlighting tokens, or for the faint text token. There are no dependencies and no MCP or terminal surface; the check runs wherever design-lint runs.

commented

bun scripts/design-lint.ts now checks the contrast of every text and accent token pair in all six themes and names each failing pair. The rule that failed the check was the 100-column comment limit: line 5 of src/design/contrast.ts was 109 characters. I rewrapped that header and pushed. After the fix bun scripts/gate.ts and bun x tsc --noEmit printed nothing, and test/contrast.test.ts passes. The forge's check has not run again on this push.

The pull still lacks the before/after pictures at 390 and 1280 px, light and dark, that the issue asks for. I could not take them from the sandbox.

What changed

  • Checked pairs: src/design/contrast.ts computes the WCAG 2.x contrast ratio for these pairs against a 4.5:1 minimum:

- fg on bg, card and muted - muted-fg on bg, card and muted - accent on bg and card - accent-fg on accent - primary-fg on primary

  • Failure output: each failing pair prints as one line, for example theme dawn: --muted-fg #797593 on --bg #faf4ed is 4.02:1, below 4.5:1. scripts/design-lint.ts runs this check alongside its other rules.
  • Token changes: the three dark themes already passed. Six pairs failed, all muted-fg in the light themes (worst case 3.67:1, Dawn on muted). I darkened muted-fg in src/design/themes.ts, and every pair now passes. Muted text in those three themes is slightly darker; no other token moved.
Thememuted-fg beforemuted-fg after
Porcelain#6b7280#646b78
Paper#6f6e69#625f5a
Dawn#797593#625e7c

Tests: test/contrast.test.ts checks the formula against hand values (black on white is 21:1, #767676 on white is 4.54:1). It asserts every theme passes, and that a failing pair is named with its theme, tokens and ratio.

Not done

  • The diff and syntax-highlighting tokens and the faint text token are not checked.
  • I did not run test/mcp-size.test.ts, since nothing here touches the MCP.
  • There is no MCP or terminal surface. The check runs wherever design-lint runs.

To try it, run bun scripts/design-lint.ts, then set a muted-fg in src/design/themes.ts to something pale and run it again to see the failing pair named.

Approved

Clean, small, zero-dependency change. contrast.ts is one concept with the WCAG formula checked against hand values, design-lint runs it, and the three light themes muted-fg tokens are darkened so every pair passes. The test fails without the token fix and names a failing pair. No security surface, no README addition, no MCP/terminal door needed. Only gap: the before/after pictures the issue asks for are not on the pull.

commented

Left #13008 open: 1 unticked item remain (before/after pictures at 390 and 1280 px, light and dark, are on the pull).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs