color cleanups
This commit is contained in:
parent
bb2732b621
commit
f30489219b
119
color.go
119
color.go
|
@ -6,30 +6,10 @@ package main
|
|||
// information about how terminfo works
|
||||
// https://jvns.ca/blog/2024/10/01/terminal-colours/
|
||||
|
||||
import (
|
||||
"github.com/awesome-gocui/gocui"
|
||||
)
|
||||
|
||||
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 superLightGrey gocui.Attribute = gocui.GetColor("#55AAFF") // super light grey
|
||||
|
||||
// Standard defined colors from gocui:
|
||||
// ColorBlack ColorRed ColorGreen ColorYellow ColorBlue ColorMagenta ColorCyan ColorWhite
|
||||
|
||||
// v.BgColor = gocui.GetColor("#111111") // crazy red
|
||||
// v.BgColor = gocui.GetColor("#FF9911") // heavy red
|
||||
// v.SelBgColor = gocui.GetColor("#FFEE11") // blood red
|
||||
|
||||
// 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{
|
||||
frame: none,
|
||||
fg: gocui.ColorBlue,
|
||||
|
@ -48,108 +28,15 @@ var colorActiveW colorT = colorT{
|
|||
selBg: none,
|
||||
name: "normal window",
|
||||
}
|
||||
*/
|
||||
|
||||
// var colorActiveW colorT = colorT{none, none, powdererBlue, none, powdererBlue, "active window"} // sets the window to blue
|
||||
|
||||
/*
|
||||
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 colorLabel colorT = colorT{none, none, superLightGrey, none, superLightGrey, "normal label"}
|
||||
// var colorGroup colorT = colorT{none, none, superLightGrey, none, superLightGrey, "normal group"}
|
||||
|
||||
/*
|
||||
var colorDisabled colorT = colorT{
|
||||
frame: superLightGrey,
|
||||
fg: superLightGrey,
|
||||
bg: superLightGrey,
|
||||
selFg: gocui.ColorBlack,
|
||||
selBg: gocui.ColorBlack,
|
||||
name: "disabled widget",
|
||||
}
|
||||
*/
|
||||
|
||||
var colorLabel colorT = colorT{
|
||||
frame: gocui.ColorWhite,
|
||||
fg: none,
|
||||
bg: none,
|
||||
selFg: none,
|
||||
selBg: none,
|
||||
name: "normal label",
|
||||
}
|
||||
|
||||
var colorGroup colorT = colorT{
|
||||
frame: none,
|
||||
fg: none,
|
||||
bg: none,
|
||||
selFg: gocui.ColorWhite,
|
||||
selBg: none,
|
||||
name: "normal label",
|
||||
}
|
||||
|
||||
var colorButton colorT = colorT{
|
||||
frame: gocui.ColorGreen,
|
||||
fg: none,
|
||||
bg: none,
|
||||
selFg: gocui.ColorGreen,
|
||||
selBg: none,
|
||||
name: "normal button",
|
||||
}
|
||||
|
||||
var colorButtonDense colorT = colorT{
|
||||
frame: none,
|
||||
fg: none,
|
||||
bg: gocui.ColorGreen,
|
||||
// bg: tcell.ColorGreen,
|
||||
selFg: none,
|
||||
selBg: gocui.ColorWhite,
|
||||
name: "normal button",
|
||||
}
|
||||
|
||||
var colorDropdown colorT = colorT{
|
||||
frame: gocui.ColorYellow,
|
||||
fg: none,
|
||||
bg: none,
|
||||
selFg: gocui.ColorYellow,
|
||||
selBg: gocui.ColorBlack,
|
||||
name: "normal dropdown",
|
||||
}
|
||||
|
||||
var colorCombobox colorT = colorT{
|
||||
frame: gocui.ColorBlue,
|
||||
fg: none,
|
||||
bg: none,
|
||||
selFg: gocui.ColorBlue,
|
||||
selBg: gocui.ColorBlack,
|
||||
name: "normal combobox",
|
||||
}
|
||||
|
||||
var colorCheckbox colorT = colorT{
|
||||
frame: gocui.ColorRed,
|
||||
fg: none,
|
||||
bg: none,
|
||||
selFg: gocui.ColorRed,
|
||||
selBg: gocui.ColorWhite,
|
||||
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
|
||||
// the user will see the colors change when this runs
|
||||
// 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.
|
||||
// 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 {
|
||||
|
|
36
colorNew.go
36
colorNew.go
|
@ -3,15 +3,24 @@
|
|||
|
||||
package main
|
||||
|
||||
// simple colors for light and dark
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
|
||||
"github.com/awesome-gocui/gocui"
|
||||
log "go.wit.com/log"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
// simple colors for light and dark
|
||||
|
||||
// information about how terminfo works
|
||||
// https://jvns.ca/blog/2024/10/01/terminal-colours/
|
||||
|
||||
// TODO: move all this to a protobuf
|
||||
// TODO: add black/white only flag for ttyS0
|
||||
// TODO: fix kvm/qemu serial console & SIGWINCH.
|
||||
// TODO: check minicom (doesn't work)
|
||||
// TODO: fix riscv boards
|
||||
|
||||
// DONE ON ENABLE() WIDGET
|
||||
// restores the last saved color and makes it active
|
||||
func (tk *guiWidget) restoreEnableColor() {
|
||||
|
@ -279,6 +288,8 @@ func (tk *guiWidget) setColorTextbox() {
|
|||
tk.updateColor()
|
||||
}
|
||||
|
||||
// just notes down here
|
||||
|
||||
// what genius figured this out?
|
||||
// originally from github.com/dimasma0305/GoFetch
|
||||
func get_teminal_color_palette() string {
|
||||
|
@ -305,3 +316,22 @@ func randColor() gocui.Attribute {
|
|||
log.Log(NOW, "randColor() i =", i)
|
||||
return gocui.GetColor(colors[i])
|
||||
}
|
||||
|
||||
var none gocui.Attribute = gocui.AttrNone
|
||||
var colorNone colorT = colorT{none, none, none, none, none, "debug none"}
|
||||
|
||||
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:
|
||||
// ColorBlack ColorRed ColorGreen ColorYellow ColorBlue ColorMagenta ColorCyan ColorWhite
|
||||
|
||||
// v.BgColor = gocui.GetColor("#111111") // crazy red
|
||||
// v.BgColor = gocui.GetColor("#FF9911") // heavy red
|
||||
// v.SelBgColor = gocui.GetColor("#FFEE11") // blood red
|
||||
|
||||
// v.BgColor = gocui.GetColor("#55AAFF") // super light grey
|
||||
// v.BgColor = gocui.GetColor("#FFC0CB") // 'w3c pink' yellow
|
||||
|
|
Loading…
Reference in New Issue