Skip to content

feat(ui): the text tokens reach 4.5:1 on every surface (0.7.0) - #62

Merged
bketelsen merged 2 commits into
mainfrom
irulan/ui-text-contrast
Nov 11, 2026
Merged

bketelsen merged 2 commits into
mainfrom
irulan/ui-text-contrast

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

@frostyard/lodge-ui 0.7.0: the 3 text tokens reach the 4.5:1 contrast that WCAG 2.x asks of body text, on each of the 4 surfaces (--bg-window, --bg-sidebar, --bg-toolbar, --bg-banner), in the light and in both dark blocks. Decision: ADR-0021.

Token Light Dark Lowest ratio (was)
--text-primary #1d1d1f (same) #f5f5f7 (same) 15.05 light / 12.80 dark
--text-secondary #6e6e73 → #5b5b60 #a1a1a6 → #aaaaaf 6.04 (4.54) / 6.02 (5.42)
--text-tertiary #a1a1a6 → #6c6c71 #6e6e73 → #95959a 4.67 (2.30) / 4.67 (2.75)
  • Why secondary moves too: the light secondary was 4.54:1 on the sidebar, so a tertiary at 4.5:1 or more had no room below it. Both schemes now keep the same step (tertiary about 4.67:1, secondary about 6.0:1 on the worst surface), and primary > secondary > tertiary holds on every surface. The hue stays the neutral grey with +5 on blue.
  • The guard: ui/test/contrast.test.ts reads tokens.css and computes each ratio, with the light block and both dark blocks read separately. It fails under 4.5:1, naming the scheme, the token, the surface and the ratio. It also fails when the 3 tokens are out of order, and it refuses any value that is not #rrggbb.
  • Docs: the token-contrast table and rule in docs/specs/ui-package.md, ui/README.md, ui/CHANGELOG.md (0.7.0), ui/package.json 0.7.0, and back-links in the overview and the roadmap. ui/test/fixtures/tokens.ts records the 2 tokens as an exception to frostmail's values, as it does for the accent.
  • Not in this PR: --badge-text also stays under 4.5:1 (4.04:1 on --badge-bg in the light, 4.41:1 in the dark). It is not one of the 3 text tokens, and ADR-0021 records it for a later change. No tag: ui/v0.7.0 comes after the merge. Each app takes the new values when it bumps its pin.

Risk tier

Risk tier: 2: a visible look change (token values) in a shared package. No path in .github/risk-paths.json matches.

Docs housekeeping

  • New docs started from their category's TEMPLATE.md (ADR-0021)
  • Every new doc indexed in docs/README.md
  • Cross-links added in both directions (ADR ↔ design ↔ spec ↔ plan)
  • New significant decision recorded as an ADR first, in this PR

Verification

  • make check green (host)
  • make ui-check green (nsl machine lodge): 10 files, 86 tests; contrast.test.ts 16 tests. Biome prints 3 earlier warnings in src/react/Menu.tsx (unused suppressions), none from this change.
  • The apps that pin the UI package still build on it: not run. By source inspection, only token values change: no exported name, class or component changes. The 4 apps pin ui/v0.6.0 and take 0.7.0 in their own bump PRs; the shell links ../ui, and CI's shell check passes at 4b12c81.
  • Revert test: with the 4 old values put back in ui/src/tokens.css, pnpm exec vitest run test/contrast.test.ts (nsl) fails 3 tests: --text-tertiary in the light block (2.57:1 on --bg-window), the media dark block (3.29:1) and the data-theme dark block (3.29:1). 13 tests pass.
  • Cross-review (openai/gpt-6.1-sol) of head 17ea75f: 1 blocking point (ADR-0021 listed the shell among the apps that bump to the tag; the shell links ../ui). Fixed in the next commit, with its guard: an AGENTS.md rule and 1 line in .memory/corrections.jsonl.
  • Re-review 1 (openai/gpt-6.1-sol) of head 4b12c81: Ready, blocking: none. CI green on all 9 jobs at 4b12c81.

--text-tertiary was 2.30:1 to 2.57:1 in the light and 2.75:1 to 3.29:1
in the dark, below the 4.5:1 that WCAG 2.x asks of body text. It now
reaches 4.67:1 or more on --bg-window, --bg-sidebar, --bg-toolbar and
--bg-banner, light and dark:

- --text-secondary: #6e6e73 -> #5b5b60 (light), #a1a1a6 -> #aaaaaf (dark)
- --text-tertiary: #a1a1a6 -> #6c6c71 (light), #6e6e73 -> #95959a (dark)

The light secondary was 4.54:1 on the sidebar, which left no room for a
tertiary at 4.5:1 below it, so it moves too. Both schemes keep the same
step, and primary > secondary > tertiary holds on every surface.

ui/test/contrast.test.ts computes each ratio from tokens.css and fails
under 4.5:1 or out of order. ADR-0021 records the decision; the spec,
the README and the changelog carry the values. A token value change is
a minor before 1.0: @frostyard/lodge-ui 0.7.0.
@github-actions github-actions Bot added the level:L3 Skim label Nov 11, 2026
ADR-0021 listed the shell among the apps that take the new greys when
they bump to ui/v0.7.0. The shell links ../ui, so it takes them at
lodge's next build. AGENTS.md now says so where it lists who bumps after
a library tag, and .memory/corrections.jsonl records the correction.
@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 11, 2026
@bketelsen
bketelsen merged commit a7bc6f2 into main Nov 11, 2026
12 checks passed
@bketelsen
bketelsen deleted the irulan/ui-text-contrast branch November 11, 2026 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L3 Skim ready-for-human Reviewed, CI green: ready for Brian to review and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants