summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--color.go101
-rw-r--r--dropdown.go1
-rw-r--r--place.go4
-rw-r--r--structs.go13
4 files changed, 104 insertions, 15 deletions
diff --git a/color.go b/color.go
index 6861d45..5e5029f 100644
--- a/color.go
+++ b/color.go
@@ -9,6 +9,8 @@ package main
import (
"math/rand"
+ "github.com/gdamore/tcell/v2"
+
"github.com/awesome-gocui/gocui"
"go.wit.com/log"
@@ -18,15 +20,6 @@ import (
//color.go: w.v.SelFgColor = gocui.ColorBlack
//color.go: w.v.BgColor = gocui.ColorGreen
-type colorT struct {
- frame gocui.Attribute
- fg gocui.Attribute
- bg gocui.Attribute
- selFg gocui.Attribute
- selBg gocui.Attribute
- 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
@@ -51,11 +44,22 @@ var colorWindow colorT = colorT{
frame: none,
fg: gocui.ColorBlue,
bg: none,
- selFg: none,
- selBg: powdererBlue,
+ selFg: gocui.ColorWhite,
+ // selBg: powdererBlue,
+ selBg: gocui.ColorBlue,
name: "normal window",
}
-var colorActiveW colorT = colorT{none, none, powdererBlue, none, powdererBlue, "active window"} // sets the window to blue
+
+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"}
@@ -103,6 +107,7 @@ var colorButtonDense colorT = colorT{
frame: none,
fg: none,
bg: gocui.ColorGreen,
+ // bg: tcell.ColorGreen,
selFg: none,
selBg: gocui.ColorWhite,
name: "normal button",
@@ -228,3 +233,75 @@ func get_teminal_color_palette() string {
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)
+ */
+}
+
+// weird. lots of color problems for me on debian sid using the traditional Andy Herzfield 'gnome'
+func (tk *guiWidget) setColorWindow() {
+ if tk.color == nil {
+ tk.color = new(colorT)
+ }
+ tk.color.frame = gocui.AttrNone
+ tk.color.fg = gocui.ColorBlue
+ tk.color.bg = gocui.AttrNone
+ tk.color.selFg = gocui.ColorWhite
+ tk.color.selBg = gocui.ColorBlue
+}
+
+func (tk *guiWidget) setColorButtonDense() {
+ if tk.color == nil {
+ tk.color = new(colorT)
+ }
+ tk.color.frame = gocui.AttrNone
+ tk.color.fg = gocui.ColorBlue
+ tk.color.bg = gocui.AttrNone
+ tk.color.selFg = gocui.ColorWhite
+ tk.color.selBg = gocui.ColorBlue
+}
diff --git a/dropdown.go b/dropdown.go
index aed5ead..e08b11c 100644
--- a/dropdown.go
+++ b/dropdown.go
@@ -137,6 +137,7 @@ func (tk *guiWidget) showTextbox() {
// log.Log(GOCUI, "showTextbox() SHOWING AT W,H=", startW, startH)
me.textbox.tk.MoveToOffset(startW+3, startH+2)
me.textbox.tk.labelN = "holy cow"
+ me.textbox.tk.SetColorRed()
me.textbox.tk.Show()
me.textbox.active = true
me.textbox.callerTK = tk
diff --git a/place.go b/place.go
index 4d6aad5..b9b18cd 100644
--- a/place.go
+++ b/place.go
@@ -145,7 +145,9 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
case widget.Button:
if tk.isWindowDense() && tk.isInGrid() {
tk.frame = false
- tk.color = &colorButtonDense
+ tk.color = nil
+ tk.defaultColor = nil
+ tk.setColorButtonDense()
}
tk.gocuiSetWH(startW, startH)
return tk.gocuiSize.Width(), tk.gocuiSize.Height()
diff --git a/structs.go b/structs.go
index e24ea21..f8cc81e 100644
--- a/structs.go
+++ b/structs.go
@@ -135,6 +135,15 @@ type window struct {
dense bool // true if the window is huge
}
+type colorT struct {
+ frame gocui.Attribute
+ fg gocui.Attribute
+ bg gocui.Attribute
+ selFg gocui.Attribute
+ selBg gocui.Attribute
+ name string
+}
+
type guiWidget struct {
v *gocui.View // this is nil if the widget is not displayed
cuiName string // what gocui uses to reference the widget (usually "TK <widgetId>"
@@ -153,7 +162,6 @@ type guiWidget struct {
labelN string // the actual text to display in the console
vals []string // dropdown menu items
enable bool // ?
- defaultColor *colorT // store the color to go back to
gocuiSize rectType // should mirror the real display size. todo: verify these are accurate. they are not yet
full rectType // full size of children (used by widget.Window, etc)
force rectType // force widget within these boundries (using this to debug window dragging)
@@ -166,8 +174,9 @@ type guiWidget struct {
frame bool // ?
selectedTab *tree.Node // for a window, this is currently selected tab
color *colorT // what color to use
+ defaultColor *colorT // the default colors // TODO: make a function for this instead
+ isBG bool // means this is the background widget. There is only one of these
// resize bool // the window is currently being resized
- isBG bool // means this is the background widget. There is only one of these
}
// THIS IS GO COMPILER MAGIC