Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add automatic light/dark theme selection - #237

#237
Merged
umputun merged 3 commits into
umputun:masterumputun/revdiff:masterfrom
jrpat:auto-light-dark-themejrpat/revdiff:auto-light-dark-themeCopy head branch name to clipboard
Jun 25, 2026
Merged

Add automatic light/dark theme selection#237
umputun merged 3 commits into
umputun:masterumputun/revdiff:masterfrom
jrpat:auto-light-dark-themejrpat/revdiff:auto-light-dark-themeCopy head branch name to clipboard

Conversation

@jrpat

@jrpat jrpat commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Problem

Many users alternate between light and dark environments and use dark backgrounds sometimes and light backgrounds sometimes. Frequently the OS is set up to automatically switch between the two.

Revdiff currently only has a way to configure a single theme which means revdiff startup can often be jarring, especially if system is dark and revdiff is light.

I am one of these users and frequently do a "gah my eyes!" the first time I run revdiff after my system switches to dark mode.

Solution

This adds a new special theme called auto and 2 new config flags auto-theme-light and auto-theme-dark. If theme = auto, we automatically resolve to either the light or dark theme depending on the terminal background color.

This is analogous to a similar feature in hunk.

ps

💛 revdiff is fantastic. Thanks for it!

@jrpat
jrpat requested a review from umputun as a code owner June 23, 2026 13:53
Copilot AI review requested due to automatic review settings June 23, 2026 13:53

Copilot AI left a comment

Copy link
Copy Markdown

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 auto theme mode that resolves to a light or dark theme at startup based on the terminal background, enabling seamless theme switching when users’ environments change.

Changes:

  • Introduces special theme name auto and resolves it via terminal background detection.
  • Adds --auto-theme-dark / --auto-theme-light (and config/env equivalents) with defaults.
  • Updates documentation and adds unit tests for the new auto-theme resolution and config parsing.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
README.md Documents --theme auto and the new auto-theme options.
plugins/codex/skills/revdiff/references/config.md Updates config reference docs with the new flags and auto behavior.
app/themes.go Implements auto theme resolution using terminal background detection.
app/themes_test.go Adds unit tests for auto theme name resolution logic.
app/config.go Adds new CLI/config/env options for auto light/dark theme selection (with defaults).
app/config_test.go Adds parsing/default tests for the new auto-theme options.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
@jrpat

jrpat commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Sorry I missed the "if this is your first contribution, start with an issue" instruction. Feel free to close this if you're not interested. I implemented it to scratch my own itch, so no wasted time 😉

Add a new special theme called `auto` and two new config flags:
`auto-theme-light` and `auto-theme-dark`.

If `theme = auto`, resolve to either the light or dark theme depending
on the terminal background color.

Defaults:
- auto-dark-theme: revdiff
- auto-light-theme: catppuccin-latte
@jrpat
jrpat force-pushed the auto-light-dark-theme branch from f3c65f2 to 88911eb Compare June 23, 2026 14:28
the PR added --auto-theme-dark/--auto-theme-light to README and the codex skill reference but missed the .claude-plugin reference copy (kept byte-identical) and site/docs.html (kept in sync with README).
…clo limit

the auto-theme branch pushed handleThemes cyclomatic complexity to 21 (>20). move the "auto" sentinel dispatch into resolveThemeName so handleThemes stays at 20. behavior unchanged - termenv is queried only when theme=auto.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread app/config.go
@@ -54,6 +54,8 @@ type options struct {
Keys string `long:"keys" env:"REVDIFF_KEYS" no-ini:"true" description:"path to keybindings file"`
DumpKeys bool `long:"dump-keys" no-ini:"true" description:"print effective keybindings to stdout and exit"`
Theme string `long:"theme" ini-name:"theme" env:"REVDIFF_THEME" description:"load theme from themes directory"`
Comment thread app/themes.go Outdated
opts.NoColors = false
}
if opts.Theme == autoThemeName {
opts.Theme = resolveAutoThemeName(*opts, termenv.HasDarkBackground())
@umputun
umputun merged commit c3ce525 into umputun:master Jun 25, 2026
2 checks passed
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.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.