gocui/color.go

171 lines
4.8 KiB
Go
Raw Normal View History

2025-02-01 11:42:31 -06:00
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0
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,
bg: none,
selFg: gocui.ColorWhite,
// selBg: powdererBlue,
selBg: gocui.ColorBlue,
name: "normal window",
}
var colorActiveW colorT = colorT{
frame: none,
fg: gocui.ColorWhite,
bg: gocui.ColorBlue,
selFg: gocui.ColorBlue,
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"}
2025-02-09 04:53:49 -06:00
/*
var colorDisabled colorT = colorT{
frame: superLightGrey,
fg: superLightGrey,
bg: superLightGrey,
selFg: gocui.ColorBlack,
selBg: gocui.ColorBlack,
name: "disabled widget",
}
2025-02-09 04:53:49 -06:00
*/
var colorLabel colorT = colorT{
frame: gocui.ColorWhite,
fg: none,
bg: none,
2025-02-01 19:42:04 -06:00
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,
2025-02-01 19:42:04 -06:00
selBg: gocui.ColorWhite,
name: "normal checkbox",
}
2025-02-09 12:57:42 -06:00
/*
// 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"}
2025-02-09 12:57:42 -06:00
*/
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
2025-02-09 12:57:42 -06:00
/*
func (tk *guiWidget) setColor(newColor *colorT) {
if tk.color == newColor {
// nothing to do since the colors have nto changed
return
}
tk.color = newColor
if tk.v == nil {
return
}
if tk.color == nil {
// log.Log(NOW, "Set the node to color = nil")
tk.color = &colorNone
}
// log.Log(NOW, "Set the node to color =", tk.color.name)
tk.Show()
}
2025-02-09 04:53:49 -06:00
*/