From eaa31de23d5084a950d99d06c2bf801f1ed0bfbf Mon Sep 17 00:00:00 2001 From: ayn2op Date: Tue, 3 Jun 2025 20:59:10 -0400 Subject: [PATCH] refactor: use SetTitleStyle instead --- go.mod | 2 +- go.sum | 2 ++ internal/ui/util.go | 15 ++++++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 106c864..3c5b5cf 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.24.3 require ( github.com/BurntSushi/toml v1.5.0 github.com/atotto/clipboard v0.1.4 - github.com/ayn2op/tview v0.0.0-20250603214911-09c86784a7ad + github.com/ayn2op/tview v0.0.0-20250604005524-8552f0de0246 github.com/deckarep/gosx-notifier v0.0.0-20180201035817-e127226297fb github.com/diamondburned/arikawa/v3 v3.5.0 github.com/diamondburned/ningen/v3 v3.0.1-0.20240808103805-f1a24c0da3d8 diff --git a/go.sum b/go.sum index d85aaf0..86a93bc 100644 --- a/go.sum +++ b/go.sum @@ -27,6 +27,8 @@ github.com/ayn2op/tview v0.0.0-20250603171947-ff81ec6ed099 h1:9i8wZAiqlpnGZufIBy github.com/ayn2op/tview v0.0.0-20250603171947-ff81ec6ed099/go.mod h1:PuMMP3J7SfW0jgAc1fdABOHJkoGbQIw3jejRAkl0API= github.com/ayn2op/tview v0.0.0-20250603214911-09c86784a7ad h1:CHZg56bCe8yesbr3smGHljQVODCLENWJYFPERX9MSug= github.com/ayn2op/tview v0.0.0-20250603214911-09c86784a7ad/go.mod h1:PuMMP3J7SfW0jgAc1fdABOHJkoGbQIw3jejRAkl0API= +github.com/ayn2op/tview v0.0.0-20250604005524-8552f0de0246 h1:C4r5c5yziN6T/FzQOeF3u/w3v4ljMKYcuyBl/AHBQtw= +github.com/ayn2op/tview v0.0.0-20250604005524-8552f0de0246/go.mod h1:PuMMP3J7SfW0jgAc1fdABOHJkoGbQIw3jejRAkl0API= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= diff --git a/internal/ui/util.go b/internal/ui/util.go index 1c7b068..0ef22c1 100644 --- a/internal/ui/util.go +++ b/internal/ui/util.go @@ -11,16 +11,21 @@ func NewConfiguredBox(box *tview.Box, cfg *config.Theme) *tview.Box { t := cfg.Title p := b.Padding box. - SetBorderColor(tcell.GetColor(b.Color)). SetBorderPadding(p[0], p[1], p[2], p[3]). SetTitleAlign(int(t.Align)). SetFocusFunc(func() { - box.SetBorderColor(tcell.GetColor(b.ActiveColor)) - box.SetTitleColor(tcell.GetColor(t.ActiveColor)) + borderColor := tcell.GetColor(b.ActiveColor) + box.SetBorderStyle(tcell.StyleDefault.Foreground(borderColor)) + + titleColor := tcell.GetColor(t.ActiveColor) + box.SetTitleStyle(tcell.StyleDefault.Foreground(titleColor)) }). SetBlurFunc(func() { - box.SetBorderColor(tcell.GetColor(b.Color)) - box.SetTitleColor(tcell.GetColor(t.Color)) + borderColor := tcell.GetColor(b.Color) + box.SetBorderStyle(tcell.StyleDefault.Foreground(borderColor)) + + titleColor := tcell.GetColor(t.Color) + box.SetTitleStyle(tcell.StyleDefault.Foreground(titleColor)) }) if b.Enabled {