diff options
Diffstat (limited to 'color.go')
| -rw-r--r-- | color.go | 122 |
1 files changed, 4 insertions, 118 deletions
@@ -7,19 +7,9 @@ package main // https://jvns.ca/blog/2024/10/01/terminal-colours/ import ( - "math/rand" - - "github.com/gdamore/tcell/v2" - "github.com/awesome-gocui/gocui" - - "go.wit.com/log" ) -//w.v.SelBgColor = gocui.ColorCyan -//color.go: w.v.SelFgColor = gocui.ColorBlack -//color.go: w.v.BgColor = gocui.ColorGreen - var none gocui.Attribute = gocui.AttrNone var lightPurple gocui.Attribute = gocui.GetColor("#DDDDDD") // light purple var darkPurple gocui.Attribute = gocui.GetColor("#FFAA55") // Dark Purple @@ -142,11 +132,14 @@ var colorCheckbox colorT = colorT{ 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"} 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 @@ -157,6 +150,7 @@ var colorNone colorT = colorT{none, none, none, none, none, "debug none"} // TODO: maybe enough of us could actually do that if we made it a goal. // TODO: start with riscv boards and fix it universally there // TODO: so just a small little 'todo' item here +/* func (tk *guiWidget) setColor(newColor *colorT) { if tk.color == newColor { // nothing to do since the colors have nto changed @@ -173,112 +167,4 @@ func (tk *guiWidget) setColor(newColor *colorT) { // log.Log(NOW, "Set the node to color =", tk.color.name) tk.Show() } - -/* -func (w *guiWidget) disableColor() { - if w.color != &colorDisabled { - w.defaultColor = w.color - } - w.setColor(&colorDisabled) -} */ - -func (w *guiWidget) setDefaultHighlight() { - if w.v == nil { - log.Log(ERROR, "SetColor() failed on view == nil") - return - } - w.v.SelBgColor = gocui.ColorGreen - w.v.SelFgColor = gocui.ColorBlack -} - -func randColor() gocui.Attribute { - colors := []string{"Green", "#FFAA55", "Yellow", "Blue", "Red", "Black", "White"} - i := rand.Intn(len(colors)) - log.Log(NOW, "randColor() i =", i) - return gocui.GetColor(colors[i]) -} - -func (w *guiWidget) redoColor(draw bool) { - if w == nil { - return - } - - log.Sleep(.05) - w.setDefaultHighlight() - // w.setDefaultWidgetColor() - w.Show() - - for _, child := range w.children { - child.redoColor(draw) - } -} - -// what genius figured this out? -// originally from github.com/dimasma0305/GoFetch -func get_teminal_color_palette() string { - // var runes rune - // color1 := "\x1b[0;29m \x1b[0m" - // runes = []rune(color1) - // view.WriteRunes(runes) - - color1 := "\x1b[0;29m \x1b[0m" - color2 := "\x1b[0;31m \x1b[0m" - color3 := "\x1b[0;32m \x1b[0m" - color4 := "\x1b[0;33m \x1b[0m" - color5 := "\x1b[0;34m \x1b[0m" - color6 := "\x1b[0;35m \x1b[0m" - color7 := "\x1b[0;36m \x1b[0m" - color8 := "\x1b[0;37m \x1b[0m" - - return color1 + " " + color2 + " " + color3 + " " + color4 + " " + color5 + " " + color6 + " " + color7 + " " + color8 -} - -func (tk *guiWidget) SetColorRed() { - tk.color = new(colorT) - tk.color.fg = gocui.ColorRed -} - -func (tk *guiWidget) setColorBlue() { - // r, g, b := - // newgreen := gocui.NewRGBColor(tcell.ColorLightBlue.RGB()) - - // tk.color.fg = gocui.ColorBlue - tk.color.bg = gocui.NewRGBColor(tcell.ColorLightBlue.RGB()) -} - -// weird. lots of color problems for me on debian sid using the traditional Andy Herzfield 'gnome' -func (tk *guiWidget) setColorButtonDenseOLD() { - /* - cellgreen := tcell.ColorLightGreen - r, g, b := cellgreen.RGB() - newgreen := gocui.NewRGBColor(r, g, b) - */ - - // tk.color.fg = gocui.ColorBlue - if tk.color == nil { - tk.color = new(colorT) - } - lightGreen := gocui.GetColor("0x90EE90") - lightGreen = gocui.GetColor("0x008000") - lightGreen = gocui.NewRGBColor(0x00, 0x80, 0x00) - - tk.color.frame = gocui.ColorYellow - tk.color.fg = gocui.AttrNone - tk.color.bg = gocui.ColorGreen - tk.color.bg = lightGreen - tk.color.bg = gocui.Attribute(tcell.ColorLightGreen) - tk.color.bg = superLightGrey - // bg: gocui.ColorGreen, - tk.color.selFg = gocui.AttrNone - tk.color.selBg = gocui.ColorGreen - - // tk.color = &colorButtonDense - - /* - tk.color.selFg = gocui.AttrNone - r, g, b := tcell.ColorLightGreen.RGB() - log.Info("color =", tcell.ColorLightGreen.CSS(), r, g, b) - tk.color.selBg = gocui.NewRGBColor(r, g, b) - */ -} |
