feat(web): Add high-contrast mode setting#1284
feat(web): Add high-contrast mode setting#1284alacritythief wants to merge 1 commit intopingdotgg:mainfrom
Conversation
- Persist and apply a high-contrast class at startup and in the root route - Add a settings toggle and restore control - Boost muted text contrast in the UI
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can disable sequence diagrams in the walkthrough.Disable the |
|
Updated the PR description with related issues that are addressed and fixed with this PR and added comparison screenshots for tool calls. |
Addresses & Fixes Related Issues
Addresses #254, #1279
Fixes #233, Fixes #400
What Changed
Added an opt-in
High contrast modesetting to improve readability in both light and dark themes without changing the default appearance when the setting is off.This includes:
highContrastModeto the existing app settings schema and persistence flowSettings > Appearancehigh-contrastclass when the setting is enabledWhy
getLocalStorageItemis usedgetLocalStorageItemis used so high contrast mode can be applied immediately at startup, before React renders.That startup read is needed to avoid a flash where the app initially renders in normal contrast and only switches to high contrast after the app mounts. This mirrors the existing theme behavior, where theme classes are also applied early to avoid visual flicker.
The setting is still stored the same way as the rest of the app settings:
AppSettingsSchemat3code:app-settings:v1local storage entryuseAppSettings().updateSettings(...)The only special handling is the early synchronous read so the root class can be applied before first paint.
Why
The app had multiple contrast issues in both dark and light mode, mainly from:
text-muted-foreground/*utilitiesThe high contrast colors were chosen to bring these muted/read-secondary states closer to WCAG AA expectations for normal text contrast, instead of relying on visually subtle opacity reductions that were falling below accessible contrast thresholds. The goal here was not to redesign the palette, but to keep the existing visual language and raise the contrast of the specific text treatments that were failing.
Rather than changing the default theme for everyone, this PR adds a focused accessibility improvement that users can opt into when they want stronger readability.
Screenshots
High Contrast setting location

High Contrast togged ON

Dark mode with high contrast OFF

Dark mode with high contrast ON

Light mode with high contrast OFF

Light mode with with high contrast ON

Tool calls with high contrast OFF

Tool calls with high contrast ON

Checklist
highContrastModeapp settingSettings > Appearancebun fmtbun lintbun typecheckNote
Add high-contrast mode setting to the app settings UI
highContrastModeboolean toAppSettingsSchema(defaultfalse) and a toggle in the Settings UI at _chat.settings.tsx with a reset-to-default button.high-contrastclass todocument.documentElementon load (before React mounts) and reactively whenever the setting changes via auseEffectin __root.tsx.Macroscope summarized 71787fd.