Conversation
Add an opt-in toggle in Settings > General that swaps the diff panel's red/green palette to blue/orange for users with color vision deficiency. Closes pingdotgg#1533
|
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 client setting to make the diff panel more colorblind-accessible by switching the addition/deletion palette from red/green to orange/blue, and wires it through settings UI + legacy migration.
Changes:
- Added
colorblindDiffColors(defaultfalse) to the client settings schema. - Updated
DiffPanelstyling to generate diff CSS dynamically based on the setting (blue/orange when enabled). - Added a General settings toggle with restore-defaults tracking and legacy localStorage migration support.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
packages/contracts/src/settings.ts |
Adds the new client setting to the schema with a decoding default. |
apps/web/src/components/DiffPanel.tsx |
Builds diff CSS based on the setting and passes it to the diff renderer. |
apps/web/src/components/settings/SettingsPanels.tsx |
Adds the Settings UI toggle and includes it in restore-defaults dirty tracking. |
apps/web/src/hooks/useSettings.ts |
Migrates the setting from legacy localStorage into the new client settings storage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Switch from invented oklch values to GitHub Primer's production-tested diffBlob tokens (blue/orange) with proper light/dark variants. Add --diffs-addition-color-override and --diffs-deletion-color-override to also recolor the -N/+N header text, not just line backgrounds.
Rename colorblindDiffColors to colorblindMode. Apply the Primer blue/orange palette to DiffStatLabel and GitActionsControl insertion/ deletion counts so all red/green stat indicators respect the setting.
juliusmarminge
left a comment
There was a problem hiding this comment.
Please add some screenshots!
|
We should also consider making this in an extendable way since we'll have high contrast mode as well (#1284), and probably custom themes in the future and don't wanna remove this all when that happens |
Remove colorblindMode from legacy migration since the setting never existed in old localStorage. Add test coverage for the schema default and a regression test confirming migration correctly ignores it.
|
Good point on extensibility. The way this is structured should play nicely with a future theme system or high-contrast mode (#1284):
Happy to restructure if you have a specific pattern in mind for how the theme/preset system should look. |
|
All feedback addressed — removed the dead migration, added tests, and added screenshots. Ready for another look when you get a chance. |
Move COLORBLIND_DIFF_STYLES to diffRendering.ts so the palette is defined once instead of duplicated across three files. Convert DiffStatLabel to accept colorblindStyle as a prop instead of calling useSettings/useTheme internally, preserving its memo() contract. Thread the prop from ChatView through MessagesTimeline and ChangedFilesTree.
What Changed
Added an opt-in Colorblind mode toggle in Settings > General. When enabled, every place in the UI that uses red/green to distinguish additions from deletions switches to blue/orange instead.
Covers three areas:
-N/+Nheader stats+additions / -deletionstext shown inline in chat messages+insertions / -deletionsin the commit dialogColor palette
The colors come from GitHub's Primer design system (
@primer/primitivesdiffBlob tokens), which is the most widely deployed colorblind-friendly diff palette in production. GitHub ships six colorblind-aware themes built on these values.#0969da#bc4c00#388bfd#db6d28Blue/orange was chosen because both hues maintain their identity under the most common forms of color vision deficiency (deuteranopia and protanopia, which affect ~8% of males). This is the same pair GitHub, Primer, and several other tools converged on after extensive accessibility research.
References:
Why
I'm colorblind. Red and green look the same to me, which makes diffs and stats hard to read. Blue and orange are distinguishable across all common forms of color vision deficiency.
Closes #1537
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
Add colorblind mode setting that replaces red/green diff colors with blue/orange
colorblindModeboolean toClientSettingsSchema(defaultfalse) and a toggle in the General settings panelCOLORBLIND_DIFF_STYLESin diffRendering.ts with light/dark palettes for addition/deletion colorsDiffPaneldynamically rebuilds its CSS via a newbuildDiffPanelCssfunction when colorblind mode or theme changes, replacing success/destructive CSS variables with blue/orangeDiffStatLabel,ChangedFilesTree,MessagesTimeline, andGitActionsControlall accept and apply the colorblind style prop for consistent rendering across the UIMacroscope summarized 6045239.
Note
Low Risk
Low risk: primarily UI/theming changes plus a new
ClientSettingsSchemaboolean with a default, affecting diff/stats coloring but not core data flows.Overview
Adds an opt-in Colorblind mode setting (
colorblindMode, defaultfalse) to client settings and exposes it in the General settings panel (including dirty-state tracking).When enabled, diff-related UI swaps red/green addition/deletion colors to a GitHub Primer blue/orange palette across the diff panel (via generated
unsafeCSSoverrides), chat diff stat labels/changed-files tree, and git commit dialog file/total stats; the active style is derived from the current theme and updates at runtime.Written by Cursor Bugbot for commit 6045239. This will update automatically on new commits. Configure here.