Allow disabling the command bar background - #3020
Open
ChrisJr404 wants to merge 1 commit into
Open
Conversation
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.
Fixes #3011. Makes
cmdbar_bganOption<Color>so a theme can turn the command bar background fill off and let the terminal show through, which is what you want with an opacity/blur setup.Themes get applied as a patch through
struct_patch, which wraps the field again, so on disk the type is effectivelyOption<Option<Color>>. To actually clear the fill you setcmdbar_bg: Some(None). A barecmdbar_bg: Nonereads as "leave the default alone" (same as omitting any field), soSome(None)is the value that disables it. When the field ends upNonethe command bar style just doesn't set abg. The default staysSome(Blue), so any theme that doesn't touch it renders exactly like before.The one thing that needed care was backward compat. Themes written before this, or hand-written following THEMES.md, have
cmdbar_bg: Some("SomeColor"), and that wouldn't parse against the new nested option. So there's a smalldeserialize_withon the patch field that accepts the legacySome("Color")form as well as the newSome(Some("Color"))/Some(None).Tests in
src/ui/style.rscover: the default still filling blue,Some(None)clearing the bg, the legacySome("Color")form still parsing, the nested form, and a round-trip back throughinto_patch_by_diff(which serializes unchanged fields asNone, so I wanted to be sure an untouchedcmdbar_bgsurvives a save/reload without turning transparent).make check(fmt + clippy + test, 85 tests) passes. Docs and changelog updated.I wasn't sure whether you'd prefer this or the
disable_cmdbar_bg: boolalternative from the issue, happy to switch if that reads cleaner to you.