Conversation
Toggle a root CSS class to swap red/green with blue/orange in diff contexts (panel backgrounds, header stats, inline stat labels). Colors from GitHub Primer's @primer/primitives diffBlob tokens. Follows the same root-class pattern as the high-contrast mode proposal (pingdotgg#1284). Closes pingdotgg#1537
|
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 |
There was a problem hiding this comment.
Pull request overview
Adds an opt-in Colorblind mode client setting that swaps red/green comparative diff colors to a blue/orange palette by toggling a root CSS class and applying scoped CSS/variable overrides.
Changes:
- Extend client settings schema with
colorblindMode(defaultfalse) and add contract/unit coverage. - Apply
colorblind-moderoot class at startup and keep it in sync at runtime via the root route. - Update diff/stat UI to use new CSS hooks and update diff panel CSS variable overrides when enabled.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/contracts/src/settings.ts | Adds colorblindMode to ClientSettingsSchema with a decoding default. |
| packages/contracts/src/settings.test.ts | Verifies DEFAULT_CLIENT_SETTINGS.colorblindMode defaults to false. |
| apps/web/src/hooks/useSettings.ts | Adds helpers to toggle the root class and read the persisted value early. |
| apps/web/src/hooks/useSettings.test.ts | Ensures legacy migration patch does not attempt to migrate colorblindMode. |
| apps/web/src/main.tsx | Applies colorblind mode before first React render to avoid a flash. |
| apps/web/src/routes/__root.tsx | Keeps the root class synced with live settings via an effect. |
| apps/web/src/index.css | Defines blue/orange variables under :root.colorblind-mode and stat color classes. |
| apps/web/src/components/settings/SettingsPanels.tsx | Adds Settings > General toggle + restore-defaults detection for the new setting. |
| apps/web/src/components/chat/DiffStatLabel.tsx | Uses new stat CSS classes so the palette can be overridden by colorblind mode. |
| apps/web/src/components/GitActionsControl.tsx | Uses new stat CSS classes for per-file/total insertions/deletions. |
| apps/web/src/components/DiffPanel.tsx | Dynamically switches @pierre/diffs override variables based on the setting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Fix diff-stat default colors to use --color-success/--color-destructive (matching text-success/text-destructive) instead of the -foreground variants. Add try/catch around getStoredColorblindMode to prevent malformed localStorage from crashing startup. Merge duplicate imports.
|
@juliusmarminge Rewrote this to follow the same root-class pattern as #1284. Toggles The one intentional difference: colorblind mode only overrides diff-specific elements, not |

What Changed
Added an opt-in Colorblind mode toggle in Settings > General. When enabled, all places where red and green appear side by side to distinguish additions from deletions switch to blue/orange instead.
This uses a CSS-first approach: toggling a
colorblind-modeclass on:rootand defining scoped overrides inindex.css. This is the same pattern as the high-contrast mode proposal in #1284, and both can coexist cleanly (:root.colorblind-mode.high-contrastjust applies both rule sets).What colorblind mode is NOT
It is not a global theme override.
--successand--destructiveare intentionally left untouched at the root level. Red is fine for error messages, delete buttons, and warnings because those don't appear next to green. The problem is specifically red next to green in comparative contexts (additions vs deletions), so the override is scoped only to those elements.Areas covered
-N/+Nheader stats (via@pierre/diffsCSS variable overrides)+additions / -deletionstext in chat messages+insertions / -deletionsin the commit dialogColor palette
From GitHub's Primer design system (
@primer/primitivesdiffBlob tokens), the most widely deployed colorblind-friendly diff palette in production.#0969da#bc4c00#388bfd#db6d28References:
Why
I'm colorblind. Red and green look the same to me, which makes diffs and stats hard to read.
Closes #1537
Compatibility with #1284
This PR follows the exact same architecture as the high-contrast mode proposal:
colorblind-modeclass on<html>)index.css(single source of truth)main.tsxto prevent FOUCuseEffectin the root routeA future unified appearance system would just manage which root classes are active.
UI Changes
Settings toggle (off by default):
Diff panel -- default (red/green) vs colorblind mode (blue/orange):
Diff stats in chat -- default vs colorblind mode:
Checklist
Note
Low Risk
Low risk: UI-only setting that swaps diff/stat color tokens via CSS and a root class, with no data/auth logic changes. Main risk is visual regressions or missing overrides in some diff contexts.
Overview
Adds an opt-in Colorblind mode client setting (
colorblindMode, defaultfalse) with a new toggle in Settings → General, tracked in the “restore defaults” dirty list.When enabled, the app toggles a
colorblind-modeclass on:root(applied early inmain.tsxto avoid FOUC and kept in sync from__root.tsx) and introduces CSS variables/classes inindex.cssto render addition/deletion comparisons as blue/orange.Updates diff-related UI to use these overrides:
DiffPanelnow generates@pierre/diffsunsafeCSSbased on the setting, and diff stat displays inGitActionsControland chatDiffStatLabelswitch from Tailwind success/destructive classes to new.diff-stat-addition/.diff-stat-deletionclasses; tests cover the new default and ensure legacy settings migration does not attempt to migrate the new key.Written by Cursor Bugbot for commit ed8e1e5. This will update automatically on new commits. Configure here.
Note
Add colorblind mode setting with blue/orange diff colors
colorblindModeboolean toClientSettingsSchema(defaultfalse) and a toggle in the General settings panel..diff-stat-additionand.diff-stat-deletionCSS classes in index.css that swap to blue/orange under acolorblind-moderoot class; diff panel colors are also dynamically generated viabuildDiffPanelCss.ColorblindModeSynccomponent in __root.tsx.GitActionsControlandDiffStatLabelto use the new classes instead oftext-success/text-destructive.Macroscope summarized ed8e1e5.