Add adaptive color support for light/dark terminal backgrounds#25
Open
lukasgabriel wants to merge 2 commits intohzqtc:mainfrom
Open
Add adaptive color support for light/dark terminal backgrounds#25lukasgabriel wants to merge 2 commits intohzqtc:mainfrom
lukasgabriel wants to merge 2 commits intohzqtc:mainfrom
Conversation
Replace hardcoded lipgloss.Color values with lipgloss.AdaptiveColor to automatically select appropriate colors based on terminal background. Add --theme flag (auto/light/dark) to override auto-detection. Consolidate all color definitions in styles.go and fix highlightForegroudColor typo. Closes hzqtc#24
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.
Implements #24:
Accent colors now adapt to the terminal's background color, which improves readability especially on light-mode terminals.
Changes
lipgloss.Colorvalues withlipgloss.AdaptiveColor{Light, Dark}, which auto-selects the appropriate color based on terminal background--themeflag (auto,light,dark) to manually override auto-detectionstyles.go(moved status colors fromdetails.go)highlightForegroudColortypoInitTheme()--themeflag in READMEScreenshots
The
--show-colorswas added to make it easy to check all colors, but it's not part of the final version.Testing steps
Suggested further changes
Taproom currently uses
lipglossandbubbleteav1.x which only detects the terminal background once at startup.If those were upgraded to v2, they would support a live color change without an app restart - for example, if your Mac is configured to automatically change theme based on time of day (like mine is 😸). If there is interest for this, I can implement this in a separate MR.