Skip to content

Add colorblind-friendly gallery themes#157

Merged
umputun merged 2 commits intoumputun:masterfrom
krajcik:add-colorblind-themes
Apr 29, 2026
Merged

Add colorblind-friendly gallery themes#157
umputun merged 2 commits intoumputun:masterfrom
krajcik:add-colorblind-themes

Conversation

@krajcik
Copy link
Copy Markdown
Contributor

@krajcik krajcik commented Apr 29, 2026

Problem

revdiff has several bundled and gallery themes, but no theme pair aimed at users who have difficulty relying on red/green distinctions in diffs.

Solution

Add two gallery-only community themes:

  • colorblind-dark
  • colorblind-light

Both use high-contrast add/remove colors and existing Chroma styles. They do not change defaults and are not marked as bundled.

Testing

  • GOTOOLCHAIN=auto make validate-themes
  • Manually previewed colorblind-dark and colorblind-light in WezTerm using both light and dark terminal color schemes
Снимок экрана 2026-04-29 в 13 57 18 Снимок экрана 2026-04-29 в 14 00 11

@krajcik krajcik requested a review from umputun as a code owner April 29, 2026 11:35
Copy link
Copy Markdown
Owner

@umputun umputun left a comment

Choose a reason for hiding this comment

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

I tested both themes locally in kitty. Dark looks fine.

Light has a real issue: chroma-style = xcode uses LiteralString = #c41a16 (red) and Comment = #177500 (green), so syntax highlighting in viewed files defeats the whole point of the theme. Very visible on markdown content.

modus-vivendi (which dark already uses) has a matching light counterpart modus-operandi in chroma. Strings blue (#2544bb), comments grey (#505050), no red/green pair. That's the right pick for the light variant since the description already cites GNU Modus.

other than that lgtm, thx for the contribution.

upd: this is what light looks like in my kitty:

image

@umputun
Copy link
Copy Markdown
Owner

umputun commented Apr 29, 2026

to expand on the chroma-style point: it's worse than just red/green tokens. Xcode's Background entry sets only a bg (bg:#ffffff) and no fg, while modus-vivendi sets both (#ffffff bg:#000000). Most markdown tokens (plain text, list items, headers via GenericHeading) have no explicit entry in xcode, so chroma's inheritance chain ends at Background with no fg color.

revdiff's writeTokenANSI (app/highlight/highlight.go:147) only writes an ANSI fg when chroma sets one, and contextHighlightStyle (app/ui/style/resolver.go:406) deliberately omits fg expecting chroma to provide it. Net effect: most CHANGELOG/markdown content renders with no fg at all and falls through to the terminal's default fg, which on a light bg is invisible.

modus-operandi is symmetric to modus-vivendi (#000000 bg:#ffffff), so unmatched tokens get explicit black fg through the same fallback chain. That's why dark works and light doesn't.

@krajcik
Copy link
Copy Markdown
Contributor Author

krajcik commented Apr 29, 2026

Done, thanks. Now looks good. Fun fact: I'm colorblind myself and didn't realize the text was red.

@krajcik krajcik requested a review from umputun April 29, 2026 20:36
Copy link
Copy Markdown
Owner

@umputun umputun left a comment

Choose a reason for hiding this comment

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

lgtm, thx. The faint +/- prefix on highlighted lines is a revdiff rendering bug, not on your theme. The highlighted line style at app/ui/style/resolver.go:193 sets bg only and expects chroma to set fg per token, but the prefix is prepended outside the chroma path so it falls through to the terminal default fg. I'll patch that separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants