Add automatic light/dark theme selection - #237
#237Merged
Merged
Add automatic light/dark theme selection#237
Conversation
There was a problem hiding this comment.
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
autoand 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.
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
force-pushed
the
auto-light-dark-theme
branch
from
June 23, 2026 14:28
f3c65f2 to
88911eb
Compare
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.
| @@ -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"` |
| opts.NoColors = false | ||
| } | ||
| if opts.Theme == autoThemeName { | ||
| opts.Theme = resolveAutoThemeName(*opts, termenv.HasDarkBackground()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
autoand 2 new config flagsauto-theme-lightandauto-theme-dark. Iftheme = 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!