summaryrefslogtreecommitdiff
path: root/gocui/color.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-17 23:39:03 -0600
committerJeff Carr <[email protected]>2024-01-17 23:39:03 -0600
commita0baba0821441d9cf38f0b33fe12fb96925c6236 (patch)
tree2aece2a890c66c36b08524e117753817078ee58c /gocui/color.go
parentbee272651ad38453aef27f098513f7be652c39bf (diff)
new paths
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'gocui/color.go')
-rw-r--r--gocui/color.go59
1 files changed, 30 insertions, 29 deletions
diff --git a/gocui/color.go b/gocui/color.go
index ca4301f..45600c3 100644
--- a/gocui/color.go
+++ b/gocui/color.go
@@ -1,8 +1,8 @@
package main
import (
- "math/rand"
"github.com/awesome-gocui/gocui"
+ "math/rand"
"go.wit.com/log"
)
@@ -13,18 +13,18 @@ import (
type colorT struct {
frame gocui.Attribute
- fg gocui.Attribute
- bg gocui.Attribute
+ fg gocui.Attribute
+ bg gocui.Attribute
selFg gocui.Attribute
selBg gocui.Attribute
- name string
+ name string
}
var none gocui.Attribute = gocui.AttrNone
-var lightPurple gocui.Attribute = gocui.GetColor("#DDDDDD") // light purple
-var darkPurple gocui.Attribute = gocui.GetColor("#FFAA55") // Dark Purple
-var heavyPurple gocui.Attribute = gocui.GetColor("#88AA55") // heavy purple
-var powdererBlue gocui.Attribute = gocui.GetColor("#B0E0E6") // w3c 'powerder blue'
+var lightPurple gocui.Attribute = gocui.GetColor("#DDDDDD") // light purple
+var darkPurple gocui.Attribute = gocui.GetColor("#FFAA55") // Dark Purple
+var heavyPurple gocui.Attribute = gocui.GetColor("#88AA55") // heavy purple
+var powdererBlue gocui.Attribute = gocui.GetColor("#B0E0E6") // w3c 'powerder blue'
var superLightGrey gocui.Attribute = gocui.GetColor("#55AAFF") // super light grey
// Standard defined colors from gocui:
@@ -37,28 +37,29 @@ var superLightGrey gocui.Attribute = gocui.GetColor("#55AAFF") // super light gr
// v.BgColor = gocui.GetColor("#55AAFF") // super light grey
// v.BgColor = gocui.GetColor("#FFC0CB") // 'w3c pink' yellow
-// Normal Text On mouseover
-// Widget Frame Text background Text background
-var colorWindow colorT = colorT{ none , gocui.ColorBlue, none , none , powdererBlue , "normal window"}
-var colorActiveW colorT = colorT{ none , none , powdererBlue , none , powdererBlue , "active window"}
+// Normal Text On mouseover
+//
+// Widget Frame Text background Text background
+var colorWindow colorT = colorT{none, gocui.ColorBlue, none, none, powdererBlue, "normal window"}
+var colorActiveW colorT = colorT{none, none, powdererBlue, none, powdererBlue, "active window"}
-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 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"}
+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"}
// 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"}
-var colorBox colorT = colorT{gocui.ColorRed , none , lightPurple , none , gocui.ColorCyan, "debug box"}
-var colorGrid colorT = colorT{gocui.ColorRed , none , lightPurple , none , gocui.ColorRed, "debug grid"}
-var colorNone colorT = colorT{ none , none , none , none , none , "debug none"}
+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"}
+var colorBox colorT = colorT{gocui.ColorRed, none, lightPurple, none, gocui.ColorCyan, "debug box"}
+var colorGrid colorT = colorT{gocui.ColorRed, none, lightPurple, none, gocui.ColorRed, "debug grid"}
+var colorNone colorT = colorT{none, none, none, none, none, "debug none"}
-// actually sets the colors for the gocui element
+// actually sets the colors for the gocui element
// the user will see the colors change when this runs
-// TODO: add black/white only flag for ttyS0
+// TODO: add black/white only flag for ttyS0
// TODO: or fix kvm/qemu serial console & SIGWINCH.
// TODO: and minicom and uboot and 5 million other things.
// TODO: maybe enough of us could actually do that if we made it a goal.
@@ -66,15 +67,15 @@ var colorNone colorT = colorT{ none , none , non
// TODO: so just a small little 'todo' item here
func (n *node) setColor(newColor *colorT) {
tk := n.tk
- if (tk.color == newColor) {
+ if tk.color == newColor {
// nothing to do since the colors have nto changed
return
}
tk.color = newColor
- if (tk.v == nil) {
+ if tk.v == nil {
return
}
- if (tk.color == nil) {
+ if tk.color == nil {
log.Log(NOW, "Set the node to color = nil")
tk.color = &colorNone
}
@@ -88,7 +89,7 @@ func (n *node) setDefaultWidgetColor() {
func (n *node) setDefaultHighlight() {
w := n.tk
- if (w.v == nil) {
+ if w.v == nil {
log.Log(ERROR, "SetColor() failed on view == nil")
return
}
@@ -105,7 +106,7 @@ func randColor() gocui.Attribute {
func (n *node) redoColor(draw bool) {
w := n.tk
- if (w == nil) {
+ if w == nil {
return
}