mirror of
https://github.com/eeeXun/GTT.git
synced 2025-05-18 00:30:40 -07:00
color button
This commit is contained in:
parent
ce1bde676e
commit
889543deda
6
color.go
6
color.go
@ -40,6 +40,7 @@ type Colors struct {
|
||||
textColor tcell.Color
|
||||
selectedColor tcell.Color
|
||||
prefixColor tcell.Color
|
||||
pressColor tcell.Color
|
||||
}
|
||||
|
||||
type Window struct {
|
||||
@ -58,8 +59,9 @@ func (w *Window) colorInit() {
|
||||
w.src.borderColor = Themes[theme]["red"]
|
||||
w.src.foregroundColor = Themes[theme]["fg"]
|
||||
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.borderColor = Themes[theme]["blue"]
|
||||
w.dst.prefixColor = Themes[theme]["yellow"]
|
||||
w.dst.prefixColor = Themes[theme]["cyan"]
|
||||
}
|
||||
|
12
main.go
12
main.go
@ -14,9 +14,9 @@ var (
|
||||
dstBox = tview.NewTextView()
|
||||
srcDropDown = tview.NewDropDown()
|
||||
dstDropDown = tview.NewDropDown()
|
||||
langButton = tview.NewButton("(1) Lang")
|
||||
styleButton = tview.NewButton("(2) Style")
|
||||
menuButton = tview.NewButton("(3) Menu")
|
||||
langButton = tview.NewButton("(1)Lang")
|
||||
styleButton = tview.NewButton("(2)Style")
|
||||
menuButton = tview.NewButton("(3)Menu")
|
||||
translateWindow = tview.NewFlex()
|
||||
langWindow = tview.NewFlex()
|
||||
mainPage = tview.NewPages()
|
||||
@ -44,11 +44,11 @@ func main() {
|
||||
AddItem(nil, 0, 1, false), 20, 1, true).
|
||||
AddItem(tview.NewFlex().SetDirection(tview.FlexColumn).
|
||||
AddItem(nil, 0, 1, false).
|
||||
AddItem(langButton, 8, 1, true).
|
||||
AddItem(langButton, 7, 1, true).
|
||||
AddItem(nil, 20, 1, false).
|
||||
AddItem(styleButton, 9, 1, true).
|
||||
AddItem(styleButton, 8, 1, true).
|
||||
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)
|
||||
|
||||
|
14
ui.go
14
ui.go
@ -72,6 +72,20 @@ func uiInit() {
|
||||
SetBorderColor(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()
|
||||
updateTitle()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user