feat(theme): add dark mode CLI theme support (#911)
Add the ability to force dark or light mode colors for CLI output, overriding the automatic terminal background detection. Changes: - Add CLITheme field to TownSettings for persisting preference - Add GetThemeMode() and HasDarkBackground() to ui package for theme detection with GT_THEME env var override - Add ApplyThemeMode() to explicitly set lipgloss dark background - Add 'gt theme cli' subcommand to view/set CLI theme preference - Initialize theme in CLI startup (persistentPreRun) - Add comprehensive tests for theme mode functionality Usage: - gt theme cli # show current theme - gt theme cli dark # force dark mode - gt theme cli light # force light mode - gt theme cli auto # auto-detect (default) - GT_THEME=dark gt status # per-command override Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,16 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
// ApplyThemeMode applies the theme mode settings to lipgloss.
|
||||
// This should be called after InitTheme() has been called.
|
||||
func ApplyThemeMode() {
|
||||
if !ShouldUseColor() {
|
||||
return
|
||||
}
|
||||
// Set lipgloss dark background flag based on theme mode
|
||||
lipgloss.SetHasDarkBackground(HasDarkBackground())
|
||||
}
|
||||
|
||||
// Ayu theme color palette
|
||||
// Dark: https://terminalcolors.com/themes/ayu/dark/
|
||||
// Light: https://terminalcolors.com/themes/ayu/light/
|
||||
|
||||
Reference in New Issue
Block a user