v/GTT
1
0
mirror of https://github.com/eeeXun/GTT.git synced 2025-05-18 08:40:35 -07:00

color button

This commit is contained in:
eeeXun 2022-10-23 15:21:10 +08:00
parent ce1bde676e
commit 889543deda
3 changed files with 24 additions and 8 deletions

View File

@ -40,6 +40,7 @@ type Colors struct {
textColor tcell.Color textColor tcell.Color
selectedColor tcell.Color selectedColor tcell.Color
prefixColor tcell.Color prefixColor tcell.Color
pressColor tcell.Color
} }
type Window struct { type Window struct {
@ -58,8 +59,9 @@ func (w *Window) colorInit() {
w.src.borderColor = Themes[theme]["red"] w.src.borderColor = Themes[theme]["red"]
w.src.foregroundColor = Themes[theme]["fg"] w.src.foregroundColor = Themes[theme]["fg"]
w.src.selectedColor = Themes[theme]["gray"] w.src.selectedColor = Themes[theme]["gray"]
w.src.prefixColor = Themes[theme]["yellow"] w.src.prefixColor = Themes[theme]["cyan"]
w.src.pressColor = Themes[theme]["purple"]
w.dst.foregroundColor = Themes[theme]["fg"] w.dst.foregroundColor = Themes[theme]["fg"]
w.dst.borderColor = Themes[theme]["blue"] w.dst.borderColor = Themes[theme]["blue"]
w.dst.prefixColor = Themes[theme]["yellow"] w.dst.prefixColor = Themes[theme]["cyan"]
} }

View File

@ -44,11 +44,11 @@ func main() {
AddItem(nil, 0, 1, false), 20, 1, true). AddItem(nil, 0, 1, false), 20, 1, true).
AddItem(tview.NewFlex().SetDirection(tview.FlexColumn). AddItem(tview.NewFlex().SetDirection(tview.FlexColumn).
AddItem(nil, 0, 1, false). AddItem(nil, 0, 1, false).
AddItem(langButton, 8, 1, true). AddItem(langButton, 7, 1, true).
AddItem(nil, 20, 1, false). AddItem(nil, 20, 1, false).
AddItem(styleButton, 9, 1, true). AddItem(styleButton, 8, 1, true).
AddItem(nil, 20, 1, false). AddItem(nil, 20, 1, false).
AddItem(menuButton, 8, 1, true). AddItem(menuButton, 7, 1, true).
AddItem(nil, 0, 1, false), 1, 1, true). AddItem(nil, 0, 1, false), 1, 1, true).
AddItem(nil, 0, 1, false) AddItem(nil, 0, 1, false)

14
ui.go
View File

@ -72,6 +72,20 @@ func uiInit() {
SetBorderColor(window.dst.borderColor). SetBorderColor(window.dst.borderColor).
SetTitleColor(window.dst.borderColor) SetTitleColor(window.dst.borderColor)
// button
langButton.SetLabelColor(window.src.foregroundColor).
SetBackgroundColorActivated(window.src.pressColor).
SetLabelColorActivated(window.src.foregroundColor).
SetBackgroundColor(window.src.selectedColor)
styleButton.SetLabelColor(window.src.foregroundColor).
SetBackgroundColorActivated(window.src.pressColor).
SetLabelColorActivated(window.src.foregroundColor).
SetBackgroundColor(window.src.selectedColor)
menuButton.SetLabelColor(window.src.foregroundColor).
SetBackgroundColorActivated(window.src.pressColor).
SetLabelColorActivated(window.src.foregroundColor).
SetBackgroundColor(window.src.selectedColor)
updateBackground() updateBackground()
updateTitle() updateTitle()