summaryrefslogtreecommitdiff
path: root/internal/tui/dashboard
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-05 19:34:01 +0200
committerPaul Buetow <paul@buetow.org>2026-03-05 19:34:01 +0200
commit5fe164e91e40e8a3f749f4143f7562f940bf9f67 (patch)
treed77b03c737628fa58171de28eb89720c96f203b2 /internal/tui/dashboard
parenta44f6ee30c11963552b5b90a19698873aa9b6b6d (diff)
feat(tui): detect terminal theme and apply palettes
Diffstat (limited to 'internal/tui/dashboard')
-rw-r--r--internal/tui/dashboard/model.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/tui/dashboard/model.go b/internal/tui/dashboard/model.go
index ac61982..a4cd4a5 100644
--- a/internal/tui/dashboard/model.go
+++ b/internal/tui/dashboard/model.go
@@ -47,6 +47,7 @@ type Model struct {
processesOffset int
streamModel eventstream.Model
showHelp bool
+ isDark bool
}
// NewModel creates a dashboard model with default refresh cadence.
@@ -59,14 +60,17 @@ func NewModelWithConfig(engine SnapshotSource, streamSource *eventstream.RingBuf
if refreshMs <= 0 {
refreshMs = defaultRefreshMs
}
- return Model{
+ m := Model{
activeTab: TabOverview,
engine: engine,
refreshEvery: time.Duration(refreshMs) * time.Millisecond,
keys: keys,
pidFilter: -1,
streamModel: eventstream.NewModel(streamSource),
+ isDark: true,
}
+ m.SetDarkMode(true)
+ return m
}
// Init starts periodic refresh ticks.
@@ -282,6 +286,12 @@ func (m *Model) SetStreamSource(source *eventstream.RingBuffer) {
m.streamModel.SetSource(source)
}
+// SetDarkMode updates dashboard child models for the active theme.
+func (m *Model) SetDarkMode(isDark bool) {
+ m.isDark = isDark
+ m.streamModel.SetDarkMode(isDark)
+}
+
// SetPidFilter updates the active PID filter used by tab render hints.
func (m *Model) SetPidFilter(pid int) {
m.pidFilter = pid