on main help sign in
chore(ui): add toggle for transparent bg to command palette (#2405)
commit81f2d3811970d823e7fbaa83d60d6ef1d6ad707d authorChristian Rocha <christian@rocha.is> dateFri 13 Mar 2026, 16:47 (7 months ago) parenteaa9a4a
4 files changed+56−15
internal/config/store.go+9 internal/ui/dialog/actions.go+13−12 internal/ui/dialog/commands.go+13−3 internal/ui/model/ui.go+21
internal/config/store.go+9
@@ -151,6 +151,15 @@ func (s *ConfigStore) SetCompactMode(scope Scope, enabled bool) error {
151151 return s.SetConfigField(scope, "options.tui.compact_mode", enabled)
152152}
153153
154+// SetTransparentBackground sets the transparent background setting and persists it.
155+func (s *ConfigStore) SetTransparentBackground(scope Scope, enabled bool) error {
156+ if s.config.Options == nil {
157+ s.config.Options = &Options{}
158+ }
159+ s.config.Options.TUI.Transparent = &enabled
160+ return s.SetConfigField(scope, "options.tui.transparent", enabled)
161+}
162+
154163// SetProviderAPIKey sets the API key for a provider and persists it.
155164func (s *ConfigStore) SetProviderAPIKey(scope Scope, providerID string, apiKey any) error {
156165 var providerConfig ProviderConfig
internal/ui/dialog/actions.go+13−12
@@ -44,20 +44,21 @@ type ActionSelectModel struct {
4444
4545// Messages for commands
4646type (
47− ActionNewSession struct{}
48− ActionToggleHelp struct{}
49− ActionToggleCompactMode struct{}
50− ActionToggleThinking struct{}
51− ActionTogglePills struct{}
52− ActionExternalEditor struct{}
53− ActionToggleYoloMode struct{}
54− ActionToggleNotifications struct{}
55− // ActionInitializeProject is a message to initialize a project.
56− ActionInitializeProject struct{}
57− ActionSummarize struct {
47+ ActionNewSession struct{}
48+ ActionToggleHelp struct{}
49+ ActionToggleCompactMode struct{}
50+ ActionToggleThinking struct{}
51+ ActionTogglePills struct{}
52+ ActionExternalEditor struct{}
53+ ActionToggleYoloMode struct{}
54+ ActionToggleNotifications struct{}
55+ ActionToggleTransparentBackground struct{}
56+ ActionInitializeProject struct{}
57+ ActionSummarize struct {
5858 SessionID string
5959 }
60− // ActionSelectReasoningEffort is a message indicating a reasoning effort has been selected.
60+ // ActionSelectReasoningEffort is a message indicating a reasoning effort
61+ // has been selected.
6162 ActionSelectReasoningEffort struct {
6263 Effort string
6364 }
internal/ui/dialog/commands.go+13−3
@@ -427,9 +427,9 @@ func (c *Commands) defaultCommands() []*CommandItem {
427427 commands = append(commands, NewCommandItem(c.com.Styles, "toggle_sidebar", "Toggle Sidebar", "", ActionToggleCompactMode{}))
428428 }
429429 if c.hasSession {
430− cfg := c.com.Config()
431− agentCfg := cfg.Agents[config.AgentCoder]
432− model := cfg.GetModelByType(agentCfg.Model)
430+ cfgPrime := c.com.Config()
431+ agentCfg := cfgPrime.Agents[config.AgentCoder]
432+ model := cfgPrime.GetModelByType(agentCfg.Model)
433433 if model != nil && model.SupportsImages {
434434 commands = append(commands, NewCommandItem(c.com.Styles, "file_picker", "Open File Picker", "ctrl+f", ActionOpenDialog{
435435 // TODO: Pass in the file picker dialog id
@@ -472,6 +472,16 @@ func (c *Commands) defaultCommands() []*CommandItem {
472472 NewCommandItem(c.com.Styles, "toggle_yolo", "Toggle Yolo Mode", "", ActionToggleYoloMode{}),
473473 NewCommandItem(c.com.Styles, "toggle_help", "Toggle Help", "ctrl+g", ActionToggleHelp{}),
474474 NewCommandItem(c.com.Styles, "init", "Initialize Project", "", ActionInitializeProject{}),
475+ )
476+
477+ // Add transparent background toggle.
478+ transparentLabel := "Disable Background Color"
479+ if cfg != nil && cfg.Options != nil && cfg.Options.TUI.Transparent != nil && *cfg.Options.TUI.Transparent {
480+ transparentLabel = "Enable Background Color"
481+ }
482+ commands = append(commands, NewCommandItem(c.com.Styles, "toggle_transparent", transparentLabel, "", ActionToggleTransparentBackground{}))
483+
484+ commands = append(commands,
475485 NewCommandItem(c.com.Styles, "quit", "Quit", "ctrl+c", tea.QuitMsg{}),
476486 )
477487
internal/ui/model/ui.go+21
@@ -1328,6 +1328,27 @@ func (m *UI) handleDialogMsg(msg tea.Msg) tea.Cmd {
13281328 return util.NewInfoMsg("Thinking mode " + status)
13291329 })
13301330 m.dialog.CloseDialog(dialog.CommandsID)
1331+ case dialog.ActionToggleTransparentBackground:
1332+ cmds = append(cmds, func() tea.Msg {
1333+ cfg := m.com.Config()
1334+ if cfg == nil {
1335+ return util.ReportError(errors.New("configuration not found"))()
1336+ }
1337+
1338+ isTransparent := cfg.Options != nil && cfg.Options.TUI.Transparent != nil && *cfg.Options.TUI.Transparent
1339+ newValue := !isTransparent
1340+ if err := m.com.Store().SetTransparentBackground(config.ScopeGlobal, newValue); err != nil {
1341+ return util.ReportError(err)()
1342+ }
1343+ m.isTransparent = newValue
1344+
1345+ status := "disabled"
1346+ if newValue {
1347+ status = "enabled"
1348+ }
1349+ return util.NewInfoMsg("Transparent background " + status)
1350+ })
1351+ m.dialog.CloseDialog(dialog.CommandsID)
13311352 case dialog.ActionQuit:
13321353 cmds = append(cmds, tea.Quit)
13331354 case dialog.ActionInitializeProject: