feat(tui): opt-in "auto" theme that follows the terminal light/dark background#3504
Merged
Conversation
…background Resolve the new "auto" theme sentinel (settings.theme, the --theme flag, or the /theme picker's "Auto (match terminal)" entry) to a configurable pair: settings.theme_dark (default "default") on dark backgrounds and settings.theme_light (default: new bundled "default-light") on light ones. The terminal background is queried synchronously (OSC 11, TTY-gated, dark fallback) before the TUI starts so the first frame has the right polarity, covering run, lean mode, board, the agent picker and new. In the full TUI, DEC mode 2031 reports switch the theme live and the mode is reset on exit. Unset or concrete theme configs keep today's behavior and emit byte-identical escape sequences. Closes #3500
dgageot
approved these changes
Jul 7, 2026
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.
Closes #3500
Adds an explicit, opt-in
autotheme that follows the terminal's light/dark background, at startup and live. Default behavior is unchanged: withoutauto, no terminal queries are emitted and escape sequences are byte-identical to today.Behavior
settings.theme: auto,--theme auto, or "Auto (match terminal)" in/themesettings.theme_dark(defaultdefault)settings.theme_light(default: new bundleddefault-light)Implementation (issue plan mapping)
pkg/tui/styles/auto_theme.go:AutoThemeRef,SetTerminalDark/TerminalIsDark(dark default),SetAutoThemeEnabled/AutoThemeEnabled,ResolveThemeRefdefault-lighttheme + contrast testpkg/tui/styles/themes/default-light.yaml, WCAG checks built oncolorutil.gohelperstheme_dark/theme_lightSettingsfields inpkg/userconfigapplyTheme()resolvesautovia a TTY-gatedlipgloss.HasDarkBackground;validateThemeandcompleteThemeacceptauto;docker-agent newnow applies the configured theme likerunandboardappModel.Initemitstea.Raw(ansi.SetModeLightDark)when auto is active;uv.DarkColorSchemeEvent/uv.LightColorSchemeEventandtea.BackgroundColorMsgapply the pair through the existingstyles.ApplyTheme+ThemeChangedMsginvalidation path;tea.RequestBackgroundColorre-issued ontea.FocusMsg; mode reset on quit and afterProgram.Runreturnssettings.theme: auto, enables/resets mode 2031 when toggled mid-sessiondocs/features/tui/index.md(new "Auto Theme" section),docs/features/cli/index.md(--themerow)Acceptance criteria
auto)theme: autopicks light/dark at launch--theme autoaccepted, validated, shell-completed; picker offers Auto and persists itpkg/config,pkg/httpclient,pkg/teamloader)Testing
pkg/tui/styles)default-lightreadabilityCSI ?997;1|2 nbytes through the real ultraviolet decoder intoappModel.Updatepkg/tui)cmd/root)Manual verification in a graphical terminal (Ghostty or kitty: launch on light and dark, flip the OS appearance while running, check for stray
?997reports after exit) remains recommended.Notes
autono longer shadows the sentinel; it lists and loads asuser:auto.docker-agent newpreviously ignoredsettings.theme; it now applies it, aligning withrunandboardas the issue assumes.github.com/creack/pty(already in the dependency graph via docker/cli) becomes a direct, test-only dependency;github.com/charmbracelet/ultravioletmoves from indirect to direct.