Răsfoiți Sursa

fix: set {background,title}_color globally

ayn2op 1 an în urmă
părinte
comite
3e7d720fd1
4 a modificat fișierele cu 4 adăugiri și 6 ștergeri
  1. 0 2
      cmd/guilds_tree.go
  2. 0 2
      cmd/message_input.go
  3. 0 2
      cmd/messages_text.go
  4. 4 0
      cmd/root.go

+ 0 - 2
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]).

+ 0 - 2
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]).

+ 0 - 2
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]).

+ 4 - 0
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