refactor: use SetTitleStyle instead

This commit is contained in:
ayn2op 2025-06-03 20:59:10 -04:00
parent 1b5f7dec66
commit eaa31de23d
3 changed files with 13 additions and 6 deletions

2
go.mod
View file

@ -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

2
go.sum
View file

@ -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=

View file

@ -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 {