feat(tui): theme switcher with preview (#264)

This commit is contained in:
Márk Magyar
2025-06-20 22:14:05 +02:00
committed by GitHub
parent 0d2f8e175a
commit eee396f903
2 changed files with 27 additions and 10 deletions

View File

@@ -77,8 +77,9 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch keyString {
// Escape always closes current modal
case "esc", "ctrl+c":
cmd := a.modal.Close()
a.modal = nil
return a, nil
return a, cmd
}
// Pass all other key presses to the modal
@@ -194,8 +195,12 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
slog.Debug("Background color", "isDark", msg.IsDark())
case modal.CloseModalMsg:
var cmd tea.Cmd
if a.modal != nil {
cmd = a.modal.Close()
}
a.modal = nil
return a, nil
return a, cmd
case commands.ExecuteCommandMsg:
updated, cmd := a.executeCommand(commands.Command(msg))
return updated, cmd