set checkbox color

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-01 11:37:46 -06:00
parent 11ebc77505
commit 6fb1a5802a
3 changed files with 22 additions and 1 deletions

2
add.go
View File

@ -56,6 +56,8 @@ func addWidget(n *tree.Node) {
return
case widget.Button:
nw.color = &colorButton
case widget.Checkbox:
nw.color = &colorCheckbox
case widget.Box:
nw.color = &colorBox
nw.isFake = true

View File

@ -54,7 +54,6 @@ var colorActiveW colorT = colorT{none, none, powdererBlue, none, powdererBlue, "
var colorTab colorT = colorT{gocui.ColorBlue, gocui.ColorBlue, none, none, powdererBlue, "normal tab"}
var colorActiveT colorT = colorT{gocui.ColorBlue, none, powdererBlue, none, powdererBlue, "active tab"}
var colorButton colorT = colorT{gocui.ColorGreen, none, gocui.ColorWhite, gocui.ColorGreen, gocui.ColorBlack, "normal button"}
var colorLabel colorT = colorT{none, none, superLightGrey, none, superLightGrey, "normal label"}
var colorGroup colorT = colorT{none, none, superLightGrey, none, superLightGrey, "normal group"}
@ -67,6 +66,24 @@ var colorDisabled colorT = colorT{
name: "disabled widget",
}
var colorButton colorT = colorT{
frame: gocui.ColorGreen,
fg: none,
bg: gocui.ColorWhite,
selFg: gocui.ColorGreen,
selBg: gocui.ColorBlack,
name: "normal button",
}
var colorCheckbox colorT = colorT{
frame: gocui.ColorRed,
fg: none,
bg: gocui.ColorWhite,
selFg: gocui.ColorGreen,
selBg: gocui.ColorBlack,
name: "normal checkbox",
}
// widget debugging colors. these widgets aren't displayed unless you are debugging
var colorRoot colorT = colorT{gocui.ColorRed, none, powdererBlue, none, gocui.ColorBlue, "debug root"}
var colorFlag colorT = colorT{gocui.ColorRed, none, powdererBlue, none, gocui.ColorGreen, "debug flag"}

View File

@ -55,6 +55,8 @@ func (tk *guiWidget) Size() (int, int) {
}
}
return maxW + me.GroupPadW + 3, maxH
case widget.Checkbox:
return len(tk.String()) + 2, 3
}
if tk.isFake {
return 0, 0