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

small: Increased-contrast mode: the palette answers prefers-contrast: more with stronger borders and text #13898

Merged opened this

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

Merged

Under prefers-contrast: more, the default light and dark themes (Porcelain and Ink) now use stronger text, border and focus-ring colours, all at 7:1 or better. bun test on the new test and the existing contrast test, design-lint, tsc --noEmit and scripts/gate.ts --fix all pass.

Notes

shipped production is serving it deploy 8e1361f

opened this

Under prefers-contrast: more, the default light and dark themes (Porcelain and Ink) now use stronger text, border and focus-ring colours, all at 7:1 or better. bun test on the new test and the existing contrast test, design-lint, tsc --noEmit and scripts/gate.ts --fix all pass. I didn't run the full suite or check the page in a browser.

  • What changed: contrastMoreCss in src/design/themes.ts is a single media block of token overrides, added to the stylesheet in src/web/style.ts right after the theme blocks. It sets --fg, --muted-fg, --border, --border-strong and --accent. The focus ring is drawn with --accent, so it follows that token. No component has its own contrast rule.
  • Test: test/contrast-more.test.ts reads the built stylesheet. It checks that the block exists once, sits after the themes, and sets every override token. It also checks that fg, muted-fg, accent, border and border-strong each reach 7:1 on bg, card and muted in both themes.
  • Left out: The other four themes (Paper, Dawn, Midnight, Aurora) are unchanged, as are the data-look previews in the settings gallery. Their palettes would each need their own overrides, so someone who wants more contrast on those picks Porcelain or Ink. Syntax-highlight and diff colours are also unchanged.
  • How to try it: Turn on the OS "increase contrast" setting, or emulate prefers-contrast: more in devtools, and open /. Text, borders and focus outlines turn stark.

The pre-push hook wanted a "Try:" line in a commit message, so there is an empty commit carrying it.

Closes #13875

2 earlier comments
commented

Under prefers-contrast: more, the default light and dark themes (Porcelain and Ink) now use stronger text, border and focus-ring colours, all at 7:1 or better. bun test on the new test and the existing contrast test, design-lint, tsc --noEmit and scripts/gate.ts --fix all pass. I didn't run the full suite or check the page in a browser.

  • What changed: contrastMoreCss in src/design/themes.ts is a single media block of token overrides, added to the stylesheet in src/web/style.ts right after the theme blocks. It sets --fg, --muted-fg, --border, --border-strong and --accent. The focus ring is drawn with --accent, so it follows that token. No component has its own contrast rule.
  • Test: test/contrast-more.test.ts reads the built stylesheet. It checks that the block exists once, sits after the themes, and sets every override token. It also checks that fg, muted-fg, accent, border and border-strong each reach 7:1 on bg, card and muted in both themes.
  • Left out: The other four themes (Paper, Dawn, Midnight, Aurora) are unchanged, as are the data-look previews in the settings gallery. Their palettes would each need their own overrides, so someone who wants more contrast on those picks Porcelain or Ink. Syntax-highlight and diff colours are also unchanged.
  • How to try it: Turn on the OS "increase contrast" setting, or emulate prefers-contrast: more in devtools, and open /. Text, borders and focus outlines turn stark.

The pre-push hook wanted a "Try:" line in a commit message, so there is an empty commit carrying it.

commented

<!-- look-pages acbfe6b6a30a --> Look pages for acbfe6b, from the gate:

  • look pages (inferred): this pull changes src/web/style.ts; the forge pictures / (src/web/style.ts), /docs (src/web/style.ts), /explore (src/web/style.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

This pull needs no change for the look-pages note, so I made no new commit and pushed nothing. The note only reports which pages the gate will picture.

What changed: src/web/style.ts now answers prefers-contrast: more. Text, borders and the focus ring go to 7:1 contrast on the default themes, Porcelain and Ink. Nothing changes for anyone who hasn't asked for more contrast. The latest commit, "Try: set the OS to increased contrast and open /", shows the stark result on /.

On the look pages: the gate inferred /, /docs, /explore and 23 more, because every page that imports style.ts is pictured. That is correct here, since the stylesheet is shared. I didn't add a Looks: override to narrow the list. Without a contrast preference set, the pictures should be unchanged, so they work as a regression check on the default look.

What I chose not to do: I didn't change any theme besides Porcelain and Ink.

How to try it: set the OS or browser to increased contrast and open /. The preview is at https://lab--13898--forge-trevato-apps.open-platform.sh.

Approved

One token-override block under prefers-contrast: more, placed after the themes, setting fg, muted-fg, border, border-strong and accent (the focus ring) for Porcelain and Ink. The tests read the served stylesheet and check 7:1 on bg, card and muted. No layout, markup or JS change, so nothing shifts and it works with JS off. Two things I would do next: (1) give Paper, Dawn, Midnight and Aurora their own overrides, or document that they ignore the preference; (2) check that surfaces using --accent as a background, such as primary buttons and --primary-fg, still read well once accent turns dark blue or light blue, and add a --muted-fg-on-primary pair to the test if not. Smaller: the test slices 1200 chars after the block start, so it will break silently if the block grows.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs