Skip to content

Add an "Increase contrast" accessibility setting to Appearance#67

Open
DragonnZhang wants to merge 2 commits into
mainfrom
loop/high-contrast
Open

Add an "Increase contrast" accessibility setting to Appearance#67
DragonnZhang wants to merge 2 commits into
mainfrom
loop/high-contrast

Conversation

@DragonnZhang

Copy link
Copy Markdown
Collaborator

What & why

Adds an "Increase contrast" toggle to Settings → Appearance → Interface,
directly below the existing Reduce motion toggle — its natural accessibility
companion. Increasing contrast is a standard desktop control (macOS Accessibility
Increase contrast, Windows contrast themes, VS Code's High Contrast themes)
that OpenWork lacked. OpenWork's borders, dividers, input outlines and
secondary/"muted" text are intentionally very low-alpha (--border is
oklch(from var(--foreground) l c h / 0.05), --muted-foreground is a 50% mix),
which is hard to read for low-vision users and in bright environments.

Closes #66.

How it works (frontend-only, no backend)

Mirrors the merged Reduce motion feature end-to-end:

  • Preference persisted in localStorage under craft-high-contrast (new key
    in lib/local-storage.ts).
  • HighContrastProvider context (context/HighContrastContext.tsx), wired in
    main.tsx beside ReduceMotionProvider. It reflects the pref as
    data-high-contrast="true" on <html>.
  • CSS in index.css gated on :root[data-high-contrast='true'] raises the
    contrast of the theme tokens — strengthening --border, --input,
    --muted-foreground, --foreground-dimmed and the focus --ring, plus a
    visible :focus-visible outline. Every theme derives those tokens from
    --foreground (which flips per light/dark), so the alpha-based overrides work
    in both light and dark and across preset themes. The theme system injects
    colors as a plain :root { … } rule, so the higher-specificity
    :root[data-high-contrast='true'] selector wins without !important.
  • Toggle added to AppearanceSettingsPage (Interface section), off by default.
  • i18n: 2 new keys (settings.appearance.increaseContrast / …Desc) across
    all 7 locales.

Verification (DoD)

  • bun run typecheck:allzero delta vs main (apps/electron carries 11
    pre-existing errors — vitest/auto-update.ts — byte-identical set on both
    branches; packages/ui and all other packages clean).
  • bun testzero delta vs main: 3578 pass, 56 fail — the identical
    pre-existing 56-failure set (diff of failing-test names is empty).
  • bun run lint:i18n:parityOK (1546 keys each; +2 in every locale).
  • Renderer build (electron:build:renderer) — succeeds; verified the rule
    survives PostCSS/Tailwind into apps/electron/dist/renderer/assets/index-*.css:
    [data-high-contrast=true]{--hc-enabled:1;--border:oklch(from var(--foreground) l c h/.28); …} plus the :focus-visible outline.

CDP assertion

e2e/assertions/high-contrast.assert.ts drives the real UI in the draft/no-session
state (no backend): opens Settings → Appearance, flips the toggle, and asserts
the switch's aria-checked, the data-high-contrast attribute on <html>, the
persisted localStorage value, and that the CSS actually applied (a
--hc-enabled marker computes to 1 on :root) — toggling twice to prove it
applies and reverts. It follows the merged reduce-motion assertion pattern.

Could not execute the CDP run in this environment: launching Electron requires
downloading the Electron binary, which the sandbox's egress policy blocks (HTTP
403 on the Electron download host) — the same environment limitation documented on
the merged Reduce motion PR (#51). Everything that does not need the Electron
binary (typecheck, tests, i18n parity, renderer bundle) passes.

Scope

Frontend/renderer only — no qwen-code backend changes.


Generated by Claude Code

@DragonnZhang DragonnZhang added enhancement New feature or request loop-bot labels Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request loop-bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an "Increase contrast" accessibility setting to Appearance

2 participants