From 087e4391ed626cd3c5c3dd522311cd90f73ef043 Mon Sep 17 00:00:00 2001 From: ayn2op Date: Sat, 7 Jan 2023 14:20:20 +0530 Subject: [PATCH] Add background color to ThemeConfig --- config.go | 6 ++++-- guilds_tree.go | 4 +++- message_input.go | 4 +++- messages_text.go | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/config.go b/config.go index 7e50d8c..202fb21 100644 --- a/config.go +++ b/config.go @@ -36,7 +36,8 @@ type ( Border bool `yaml:"border"` BorderPadding [4]int `yaml:"border_padding,flow"` - TitleColor string `yaml:"title_color"` + TitleColor string `yaml:"title_color"` + BackgroundColor string `yaml:"background_color"` } GuildsTreeThemeConfig struct { @@ -83,7 +84,8 @@ func newConfig() (*Config, error) { Border: true, BorderPadding: [...]int{0, 0, 1, 1}, - TitleColor: "default", + TitleColor: "default", + BackgroundColor: "default", } commonKeys := CommonKeysConfig{ diff --git a/guilds_tree.go b/guilds_tree.go index 97e1d7e..06a8db3 100644 --- a/guilds_tree.go +++ b/guilds_tree.go @@ -29,8 +29,10 @@ func newGuildsTree() *GuildsTree { gt.SetTopLevel(1) gt.SetSelectedFunc(gt.onSelected) + gt.SetBackgroundColor(tcell.GetColor(cfg.Theme.GuildsTree.BackgroundColor)) + gt.SetTitle("Guilds") - gt.SetTitleColor(tcell.GetColor(cfg.Theme.MessagesText.TitleColor)) + gt.SetTitleColor(tcell.GetColor(cfg.Theme.GuildsTree.TitleColor)) gt.SetTitleAlign(tview.AlignLeft) padding := cfg.Theme.GuildsTree.BorderPadding diff --git a/message_input.go b/message_input.go index 5d3adb8..52e4844 100644 --- a/message_input.go +++ b/message_input.go @@ -23,7 +23,9 @@ func newMessageInput() *MessageInput { mi.SetFieldBackgroundColor(tview.Styles.PrimitiveBackgroundColor) mi.SetInputCapture(mi.onInputCapture) - mi.SetTitleColor(tcell.GetColor(cfg.Theme.MessagesText.TitleColor)) + mi.SetBackgroundColor(tcell.GetColor(cfg.Theme.MessageInput.BackgroundColor)) + + mi.SetTitleColor(tcell.GetColor(cfg.Theme.MessageInput.TitleColor)) mi.SetTitleAlign(tview.AlignLeft) padding := cfg.Theme.MessageInput.BorderPadding diff --git a/messages_text.go b/messages_text.go index 79297bb..16c6eff 100644 --- a/messages_text.go +++ b/messages_text.go @@ -28,6 +28,8 @@ func newMessagesText() *MessagesText { mt.SetHighlightedFunc(mt.onHighlighted) mt.SetInputCapture(mt.onInputCapture) + mt.SetBackgroundColor(tcell.GetColor(cfg.Theme.MessagesText.BackgroundColor)) + mt.SetTitle("Messages") mt.SetTitleColor(tcell.GetColor(cfg.Theme.MessagesText.TitleColor)) mt.SetTitleAlign(tview.AlignLeft)