Skip to content

Add adaptive color support for light/dark terminal backgrounds#25

Open
lukasgabriel wants to merge 2 commits intohzqtc:mainfrom
lukasgabriel:feature/light-dark-theme
Open

Add adaptive color support for light/dark terminal backgrounds#25
lukasgabriel wants to merge 2 commits intohzqtc:mainfrom
lukasgabriel:feature/light-dark-theme

Conversation

@lukasgabriel
Copy link
Copy Markdown

Implements #24:
Accent colors now adapt to the terminal's background color, which improves readability especially on light-mode terminals.

Changes

  • Replace all hardcoded lipgloss.Color values with lipgloss.AdaptiveColor{Light, Dark}, which auto-selects the appropriate color based on terminal background
  • Add --theme flag (auto, light, dark) to manually override auto-detection
  • Consolidate all color definitions in styles.go (moved status colors from details.go)
  • Fix highlightForegroudColor typo
  • Add unit tests for InitTheme()
  • Document --theme flag in README

Screenshots

image image

The --show-colors was added to make it easy to check all colors, but it's not part of the final version.

Testing steps

taproom --theme dark # should look identical to current behavior
taproom --theme light # better contrast colors in light-mode terminals
taproom # auto-detects terminal background

Suggested further changes

Taproom currently uses lipgloss and bubbletea v1.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.

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
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.

1 participant