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:
Kody Wildfeuer
2026-01-25 01:15:48 -05:00
committed by GitHub
parent 377b4877cd
commit baf9311bfe
6 changed files with 338 additions and 3 deletions

View File

@@ -39,6 +39,12 @@ type TownSettings struct {
Type string `json:"type"` // "town-settings"
Version int `json:"version"` // schema version
// CLITheme controls CLI output color scheme.
// Values: "dark", "light", "auto" (default).
// "auto" lets the terminal emulator's background color guide the choice.
// Can be overridden by GT_THEME environment variable.
CLITheme string `json:"cli_theme,omitempty"`
// DefaultAgent is the name of the agent preset to use by default.
// Can be a built-in preset ("claude", "gemini", "codex", "cursor", "auggie", "amp")
// or a custom agent name defined in settings/agents.json.