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
|
|
|
|
|
2024-01-18 00:08:37 -06:00
|
|
|
package main
|
|
|
|
|
2024-10-03 06:58:04 -05:00
|
|
|
// information about how terminfo works
|
|
|
|
// https://jvns.ca/blog/2024/10/01/terminal-colours/
|
|
|
|
|
2024-01-18 00:08:37 -06:00
|
|
|
import (
|
2024-01-28 02:20:31 -06:00
|
|
|
"github.com/awesome-gocui/gocui"
|
2024-01-18 00:08:37 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
2024-01-30 03:17:15 -06:00
|
|
|
var colorWindow colorT = colorT{
|
2024-01-30 02:38:06 -06:00
|
|
|
frame: none,
|
2024-01-30 03:17:15 -06:00
|
|
|
fg: gocui.ColorBlue,
|
|
|
|
bg: none,
|
2025-02-07 01:55:27 -06:00
|
|
|
selFg: gocui.ColorWhite,
|
|
|
|
// selBg: powdererBlue,
|
|
|
|
selBg: gocui.ColorBlue,
|
2024-01-30 03:17:15 -06:00
|
|
|
name: "normal window",
|
2024-01-30 02:38:06 -06:00
|
|
|
}
|
2025-02-07 01:55:27 -06:00
|
|
|
|
|
|
|
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
|
2024-01-18 00:08:37 -06:00
|
|
|
|
|
|
|
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"}
|
|
|
|
|
2024-02-29 19:18:00 -06:00
|
|
|
// var colorLabel colorT = colorT{none, none, superLightGrey, none, superLightGrey, "normal label"}
|
|
|
|
// var colorGroup colorT = colorT{none, none, superLightGrey, none, superLightGrey, "normal group"}
|
2024-01-18 00:08:37 -06:00
|
|
|
|
2025-02-09 04:53:49 -06:00
|
|
|
/*
|
2024-01-30 03:17:15 -06:00
|
|
|
var colorDisabled colorT = colorT{
|
2024-01-30 02:38:06 -06:00
|
|
|
frame: superLightGrey,
|
2024-01-30 03:17:15 -06:00
|
|
|
fg: superLightGrey,
|
|
|
|
bg: superLightGrey,
|
2024-01-30 02:38:06 -06:00
|
|
|
selFg: gocui.ColorBlack,
|
|
|
|
selBg: gocui.ColorBlack,
|
2024-01-30 03:17:15 -06:00
|
|
|
name: "disabled widget",
|
2024-01-30 02:38:06 -06:00
|
|
|
}
|
2025-02-09 04:53:49 -06:00
|
|
|
*/
|
2024-01-30 02:38:06 -06:00
|
|
|
|
2024-02-29 19:18:00 -06:00
|
|
|
var colorLabel colorT = colorT{
|
|
|
|
frame: gocui.ColorWhite,
|
|
|
|
fg: none,
|
|
|
|
bg: none,
|
2025-02-01 19:42:04 -06:00
|
|
|
selFg: none,
|
2024-02-29 19:18:00 -06:00
|
|
|
selBg: none,
|
|
|
|
name: "normal label",
|
|
|
|
}
|
|
|
|
|
|
|
|
var colorGroup colorT = colorT{
|
|
|
|
frame: none,
|
|
|
|
fg: none,
|
|
|
|
bg: none,
|
|
|
|
selFg: gocui.ColorWhite,
|
|
|
|
selBg: none,
|
|
|
|
name: "normal label",
|
|
|
|
}
|
|
|
|
|
2024-02-01 11:37:46 -06:00
|
|
|
var colorButton colorT = colorT{
|
|
|
|
frame: gocui.ColorGreen,
|
|
|
|
fg: none,
|
2024-02-29 19:18:00 -06:00
|
|
|
bg: none,
|
2024-02-01 11:37:46 -06:00
|
|
|
selFg: gocui.ColorGreen,
|
2024-02-29 19:18:00 -06:00
|
|
|
selBg: none,
|
2024-02-01 11:37:46 -06:00
|
|
|
name: "normal button",
|
|
|
|
}
|
|
|
|
|
2025-02-06 21:25:51 -06:00
|
|
|
var colorButtonDense colorT = colorT{
|
|
|
|
frame: none,
|
|
|
|
fg: none,
|
|
|
|
bg: gocui.ColorGreen,
|
2025-02-07 01:55:27 -06:00
|
|
|
// bg: tcell.ColorGreen,
|
2025-02-06 21:25:51 -06:00
|
|
|
selFg: none,
|
|
|
|
selBg: gocui.ColorWhite,
|
|
|
|
name: "normal button",
|
|
|
|
}
|
|
|
|
|
2024-02-01 18:28:59 -06:00
|
|
|
var colorDropdown colorT = colorT{
|
|
|
|
frame: gocui.ColorYellow,
|
|
|
|
fg: none,
|
2024-02-29 19:18:00 -06:00
|
|
|
bg: none,
|
2024-02-01 18:28:59 -06:00
|
|
|
selFg: gocui.ColorYellow,
|
|
|
|
selBg: gocui.ColorBlack,
|
2024-02-29 19:18:00 -06:00
|
|
|
name: "normal dropdown",
|
2024-02-01 18:28:59 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
var colorCombobox colorT = colorT{
|
|
|
|
frame: gocui.ColorBlue,
|
|
|
|
fg: none,
|
2024-02-29 19:18:00 -06:00
|
|
|
bg: none,
|
2024-02-01 18:28:59 -06:00
|
|
|
selFg: gocui.ColorBlue,
|
|
|
|
selBg: gocui.ColorBlack,
|
2024-02-29 19:18:00 -06:00
|
|
|
name: "normal combobox",
|
2024-02-01 18:28:59 -06:00
|
|
|
}
|
|
|
|
|
2024-02-01 11:37:46 -06:00
|
|
|
var colorCheckbox colorT = colorT{
|
|
|
|
frame: gocui.ColorRed,
|
|
|
|
fg: none,
|
2024-02-29 19:18:00 -06:00
|
|
|
bg: none,
|
2024-02-01 18:28:59 -06:00
|
|
|
selFg: gocui.ColorRed,
|
2025-02-01 19:42:04 -06:00
|
|
|
selBg: gocui.ColorWhite,
|
2024-02-01 11:37:46 -06:00
|
|
|
name: "normal checkbox",
|
|
|
|
}
|
|
|
|
|
2025-02-09 12:57:42 -06:00
|
|
|
/*
|
2024-01-18 00:08:37 -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
|
|
|
*/
|
|
|
|
|
2024-01-18 00:08:37 -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
|
|
|
/*
|
2024-01-28 11:07:51 -06:00
|
|
|
func (tk *guiWidget) setColor(newColor *colorT) {
|
2024-01-18 00:08:37 -06:00
|
|
|
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 {
|
2025-01-31 13:00:26 -06:00
|
|
|
// log.Log(NOW, "Set the node to color = nil")
|
2024-01-18 00:08:37 -06:00
|
|
|
tk.color = &colorNone
|
|
|
|
}
|
2025-01-31 13:00:26 -06:00
|
|
|
// log.Log(NOW, "Set the node to color =", tk.color.name)
|
2024-02-05 03:19:08 -06:00
|
|
|
tk.Show()
|
2024-01-18 00:08:37 -06:00
|
|
|
}
|
2025-02-09 04:53:49 -06:00
|
|
|
*/
|