summaryrefslogtreecommitdiff
path: root/internal/ui/table.go
diff options
context:
space:
mode:
authorPaul Bütow <1224732+snonux@users.noreply.github.com>2025-06-24 23:22:29 +0300
committerPaul Bütow <1224732+snonux@users.noreply.github.com>2025-06-24 23:22:29 +0300
commit60da6c59bcc58605bcc13609c855e32f045e9a1c (patch)
treeee013ed633d9431e6211f22ef3894552ea2ae74e /internal/ui/table.go
parentdbfba814e68bd6b679b2fd77bf10d34336485238 (diff)
Add disco mode with flag and hotkey
Diffstat (limited to 'internal/ui/table.go')
-rw-r--r--internal/ui/table.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/ui/table.go b/internal/ui/table.go
index bac9f0b..d75f350 100644
--- a/internal/ui/table.go
+++ b/internal/ui/table.go
@@ -112,6 +112,7 @@ type Model struct {
theme Theme
defaultTheme Theme
+ disco bool
}
// editDoneMsg is emitted when the external editor process finishes.
@@ -148,6 +149,10 @@ func (m *Model) startBlink(id int, markDone bool) tea.Cmd {
if m.blinkRow == -1 {
return nil
}
+ if m.disco {
+ m.theme = RandomTheme()
+ m.applyTheme()
+ }
m.blinkOn = true
m.blinkCount = 0
m.updateBlinkRow()
@@ -764,6 +769,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.theme = m.defaultTheme
m.applyTheme()
return m, nil
+ case "x":
+ m.disco = !m.disco
+ return m, nil
case " ":
m.reload()
return m, nil
@@ -904,6 +912,7 @@ func (m Model) View() string {
"t: edit tags",
"c: random theme",
"C: reset theme",
+ "x: toggle disco mode",
"space: refresh tasks",
"/, ?: search",
"n/N: next/prev search match",
@@ -1406,6 +1415,11 @@ func (m *Model) applyTheme() {
m.tbl.SetStyles(m.tblStyles)
}
+// SetDisco enables or disables disco mode.
+func (m *Model) SetDisco(d bool) {
+ m.disco = d
+}
+
func centerLines(s string, width int) string {
lines := strings.Split(strings.TrimRight(s, "\n"), "\n")
style := lipgloss.NewStyle().Width(width).Align(lipgloss.Center)