Skip to content

Add colorblind mode setting#1535

Closed
TimCrooker wants to merge 5 commits intopingdotgg:mainfrom
TimCrooker:feat/colorblind-diff-colors
Closed

Add colorblind mode setting#1535
TimCrooker wants to merge 5 commits intopingdotgg:mainfrom
TimCrooker:feat/colorblind-diff-colors

Conversation

@TimCrooker
Copy link
Copy Markdown

@TimCrooker TimCrooker commented Mar 29, 2026

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:

  • Diff panel — line backgrounds, emphasis highlights, and the -N/+N header stats
  • DiffStatLabel — the +additions / -deletions text shown inline in chat messages
  • GitActionsControl — per-file and total +insertions / -deletions in the commit dialog

Color palette

The colors come from GitHub's Primer design system (@primer/primitives diffBlob tokens), which is the most widely deployed colorblind-friendly diff palette in production. GitHub ships six colorblind-aware themes built on these values.

Addition (blue) Deletion (orange)
Light #0969da #bc4c00
Dark #388bfd #db6d28

Blue/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):

Screenshot 2026-03-29 at 12 49 17 PM Screenshot 2026-03-29 at 12 49 21 PM

Diff panel — default (red/green) vs colorblind mode (blue/orange):

Screenshot 2026-03-29 at 12 50 06 PM Screenshot 2026-03-29 at 12 50 15 PM

Diff stats in chat — default vs colorblind mode:

Screenshot 2026-03-29 at 12 50 26 PM Screenshot 2026-03-29 at 12 50 38 PM

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Add colorblind mode setting that replaces red/green diff colors with blue/orange

  • Adds a colorblindMode boolean to ClientSettingsSchema (default false) and a toggle in the General settings panel
  • Introduces COLORBLIND_DIFF_STYLES in diffRendering.ts with light/dark palettes for addition/deletion colors
  • DiffPanel dynamically rebuilds its CSS via a new buildDiffPanelCss function when colorblind mode or theme changes, replacing success/destructive CSS variables with blue/orange
  • DiffStatLabel, ChangedFilesTree, MessagesTimeline, and GitActionsControl all accept and apply the colorblind style prop for consistent rendering across the UI

Macroscope summarized 6045239.


Note

Low Risk
Low risk: primarily UI/theming changes plus a new ClientSettingsSchema boolean with a default, affecting diff/stats coloring but not core data flows.

Overview
Adds an opt-in Colorblind mode setting (colorblindMode, default false) 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 unsafeCSS overrides), 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.

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
Copilot AI review requested due to automatic review settings March 29, 2026 15:38
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 16d2467b-b3cc-40ae-aa6e-9d1f83357858

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 29, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (default false) to the client settings schema.
  • Updated DiffPanel styling 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.
@TimCrooker TimCrooker changed the title Add colorblind-friendly diff colors setting Add colorblind mode setting Mar 29, 2026
@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Mar 29, 2026
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some screenshots!

@juliusmarminge
Copy link
Copy Markdown
Member

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.
@TimCrooker
Copy link
Copy Markdown
Author

Good point on extensibility. The way this is structured should play nicely with a future theme system or high-contrast mode (#1284):

  • The diff panel colors are isolated in a single buildDiffPanelCss() function that takes a flag and a theme. If you move to a general theme/preset system later, that function just needs to accept a theme key instead of a boolean, and the CSS variable overrides stay the same.
  • The DiffStatLabel and GitActionsControl stat colors use a CB_STYLES object keyed by light/dark. Extending that to additional palettes (high contrast, custom themes) is a straightforward object lookup change.
  • Nothing here touches the base --success/--destructive CSS variables. It's all override-layer, so ripping it out or replacing it with a broader theme system later shouldn't require undoing anything.

Happy to restructure if you have a specific pattern in mind for how the theme/preset system should look.

@TimCrooker
Copy link
Copy Markdown
Author

All feedback addressed — removed the dead migration, added tests, and added screenshots. Ready for another look when you get a chance.

@TimCrooker TimCrooker marked this pull request as ready for review March 29, 2026 16:57
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add colorblind-friendly diff colors setting

3 participants