From 3e7d720fd1faaecd4eb9b9bb9931eba6c93605f1 Mon Sep 17 00:00:00 2001 From: ayn2op Date: Sat, 29 Mar 2025 19:18:13 -0400 Subject: [PATCH] fix: set {background,title}_color globally --- cmd/guilds_tree.go | 2 -- cmd/message_input.go | 2 -- cmd/messages_text.go | 2 -- cmd/root.go | 4 ++++ 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cmd/guilds_tree.go b/cmd/guilds_tree.go index 5b01ee4..e2d781a 100644 --- a/cmd/guilds_tree.go +++ b/cmd/guilds_tree.go @@ -39,9 +39,7 @@ func newGuildsTree(app *tview.Application, cfg *config.Config) *GuildsTree { p := b.Padding gt. SetInputCapture(gt.onInputCapture). - SetBackgroundColor(tcell.GetColor(cfg.Theme.BackgroundColor)). SetTitle("Guilds"). - SetTitleColor(tcell.GetColor(cfg.Theme.TitleColor)). SetTitleAlign(tview.AlignLeft). SetBorder(b.Enabled). SetBorderPadding(p[0], p[1], p[2], p[3]). diff --git a/cmd/message_input.go b/cmd/message_input.go index 9233745..6c9bc25 100644 --- a/cmd/message_input.go +++ b/cmd/message_input.go @@ -46,8 +46,6 @@ func newMessageInput(app *tview.Application, cfg *config.Config) *MessageInput { p := b.Padding mi. SetInputCapture(mi.onInputCapture). - SetBackgroundColor(tcell.GetColor(t.BackgroundColor)). - SetTitleColor(tcell.GetColor(t.TitleColor)). SetTitleAlign(tview.AlignLeft). SetBorder(b.Enabled). SetBorderPadding(p[0], p[1], p[2], p[3]). diff --git a/cmd/messages_text.go b/cmd/messages_text.go index da7e8ae..dbfc8f7 100644 --- a/cmd/messages_text.go +++ b/cmd/messages_text.go @@ -54,9 +54,7 @@ func newMessagesText(app *tview.Application, cfg *config.Config) *MessagesText { p := b.Padding mt. SetInputCapture(mt.onInputCapture). - SetBackgroundColor(tcell.GetColor(t.BackgroundColor)). SetTitle("Messages"). - SetTitleColor(tcell.GetColor(t.TitleColor)). SetTitleAlign(tview.AlignLeft). SetBorder(b.Enabled). SetBorderPadding(p[0], p[1], p[2], p[3]). diff --git a/cmd/root.go b/cmd/root.go index b9071fa..2e1302f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -6,6 +6,7 @@ import ( "github.com/ayn2op/discordo/internal/config" "github.com/ayn2op/discordo/internal/consts" "github.com/ayn2op/discordo/internal/logger" + "github.com/gdamore/tcell/v2" "github.com/rivo/tview" "github.com/spf13/cobra" "github.com/zalando/go-keyring" @@ -37,6 +38,9 @@ var ( return err } + tview.Styles.PrimitiveBackgroundColor = tcell.GetColor(cfg.Theme.BackgroundColor) + tview.Styles.TitleColor = tcell.GetColor(cfg.Theme.TitleColor) + tview.Borders.Horizontal = cfg.Theme.Border.Preset.Horizontal tview.Borders.Vertical = cfg.Theme.Border.Preset.Vertical tview.Borders.TopLeft = cfg.Theme.Border.Preset.TopLeft