feat(themes): support "none" color for the terminal default - #1126
Open
ChrisJr404 wants to merge 1 commit into
Open
feat(themes): support "none" color for the terminal default#1126ChrisJr404 wants to merge 1 commit into
ChrisJr404 wants to merge 1 commit into
Conversation
Add a "none" pseudo-color (also accepted as "default"/"reset") that maps to
ratatui's Color::Reset, so a theme or an override can leave an element uncolored
and fall back to the terminal's default. This makes it possible to keep a
transparent background when overriding a builtin theme, e.g.
[ui.theme_overrides]
background = "none"
Closes alexpasmantier#1103
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.
📺 PR Description
This adds a
"none"pseudo-color that maps to the terminal's default color, so a theme (or atheme_overridesentry) can leave an element uncolored instead of forcing a concrete color. It closes #1103.The motivation is transparency: when you start from a builtin theme but want the background to fall through to your terminal emulator (which may be transparent), there was previously no way to express that through an override — every value had to be a concrete ANSI or hex color.
background = "none"now keeps the terminal's own background. The same works for any foreground field if you'd rather inherit the terminal default there too.Under the hood this is a new
Color::Resetvariant that resolves toratatui'sColor::Reset. Parsing goes through the singleColor::from_strused by both theme files and overrides, so both paths pick it up."none"is the primary spelling;"default"and"reset"are accepted as aliases. Existing themes are unaffected — no builtin uses these words.Docs: added a line to the theme color reference in
docs/user-guide/05-themes.md.Checklist
Tests
Added four unit tests in
config::themes:"none"/"default"/"reset"(case-insensitive) parse toColor::Reset;Color::Resetconverts toratatui::style::Color::Reset;background = "none"deserializes from a theme file; and an override ofbackground = "none"merges correctly.cargo test --lib themespasses (11/11), andcargo fmt --check/cargo clippy --libare clean.