2025-02-07 02:34:40 -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
|
|
|
|
|
|
|
|
// simple colors for light and dark
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/awesome-gocui/gocui"
|
|
|
|
)
|
|
|
|
|
2025-02-09 04:33:30 -06:00
|
|
|
func (tk *guiWidget) updateColor() {
|
|
|
|
if tk.v == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
tk.v.FrameColor = tk.color.frame
|
|
|
|
tk.v.FgColor = tk.color.fg
|
|
|
|
tk.v.BgColor = tk.color.bg
|
|
|
|
tk.v.SelFgColor = tk.color.selFg
|
|
|
|
tk.v.SelBgColor = tk.color.selBg
|
|
|
|
}
|
|
|
|
|
2025-02-07 02:49:11 -06:00
|
|
|
func (tk *guiWidget) setColorWindowFrame() {
|
|
|
|
if tk.color == nil {
|
|
|
|
tk.color = new(colorT)
|
|
|
|
}
|
|
|
|
if me.dark { // use a dark color palette
|
|
|
|
tk.color.frame = gocui.AttrNone
|
|
|
|
tk.color.fg = gocui.ColorBlack
|
|
|
|
tk.color.bg = gocui.ColorBlack
|
|
|
|
tk.color.selFg = gocui.AttrNone
|
|
|
|
tk.color.selBg = gocui.AttrNone
|
2025-02-09 04:33:30 -06:00
|
|
|
tk.updateColor()
|
2025-02-07 02:49:11 -06:00
|
|
|
return
|
|
|
|
}
|
|
|
|
tk.color.frame = gocui.AttrNone
|
|
|
|
tk.color.fg = gocui.AttrNone
|
|
|
|
tk.color.bg = gocui.AttrNone
|
|
|
|
tk.color.selFg = gocui.AttrNone
|
|
|
|
tk.color.selBg = gocui.AttrNone
|
2025-02-09 04:33:30 -06:00
|
|
|
|
|
|
|
tk.updateColor()
|
2025-02-07 02:49:11 -06:00
|
|
|
}
|
|
|
|
|
2025-02-07 02:34:40 -06:00
|
|
|
// weird. lots of color problems for me on debian sid using the traditional Andy Herzfield 'gnome'
|
2025-02-09 04:33:30 -06:00
|
|
|
func (tk *guiWidget) setColorWindowTitleActive() {
|
2025-02-07 02:34:40 -06:00
|
|
|
if tk.color == nil {
|
|
|
|
tk.color = new(colorT)
|
|
|
|
}
|
|
|
|
if me.dark { // use a dark color palette
|
|
|
|
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
|
2025-02-09 04:33:30 -06:00
|
|
|
tk.updateColor()
|
2025-02-07 02:34:40 -06:00
|
|
|
return
|
|
|
|
}
|
|
|
|
tk.color.frame = gocui.ColorWhite
|
2025-02-09 04:19:32 -06:00
|
|
|
tk.color.fg = gocui.ColorWhite
|
2025-02-07 02:34:40 -06:00
|
|
|
tk.color.bg = gocui.ColorBlue
|
2025-02-09 04:19:32 -06:00
|
|
|
tk.color.selFg = gocui.ColorWhite
|
|
|
|
tk.color.selBg = gocui.ColorBlue
|
2025-02-09 04:33:30 -06:00
|
|
|
|
|
|
|
tk.updateColor()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (tk *guiWidget) setColorWindowTitle() {
|
|
|
|
if tk.color == nil {
|
|
|
|
tk.color = new(colorT)
|
|
|
|
}
|
|
|
|
if me.dark { // use a dark color palette
|
|
|
|
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
|
|
|
|
tk.updateColor()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
tk.color.frame = gocui.ColorWhite
|
|
|
|
tk.color.fg = gocui.ColorBlue
|
|
|
|
tk.color.bg = gocui.AttrNone
|
|
|
|
tk.color.selFg = gocui.ColorWhite
|
|
|
|
tk.color.selBg = gocui.ColorBlue
|
|
|
|
|
|
|
|
tk.updateColor()
|
2025-02-07 02:34:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (tk *guiWidget) setColorBG() {
|
|
|
|
if tk.color == nil {
|
|
|
|
tk.color = new(colorT)
|
|
|
|
}
|
|
|
|
if me.dark {
|
|
|
|
tk.color.frame = gocui.AttrNone
|
|
|
|
tk.color.fg = gocui.ColorBlack
|
|
|
|
tk.color.bg = gocui.ColorBlack
|
|
|
|
tk.color.selFg = gocui.AttrNone
|
|
|
|
tk.color.selBg = gocui.AttrNone
|
2025-02-09 04:33:30 -06:00
|
|
|
tk.updateColor()
|
2025-02-07 02:34:40 -06:00
|
|
|
return
|
|
|
|
}
|
|
|
|
tk.color.frame = gocui.ColorWhite
|
|
|
|
tk.color.fg = gocui.ColorWhite
|
|
|
|
tk.color.bg = gocui.AttrNone
|
|
|
|
tk.color.selFg = gocui.AttrNone
|
|
|
|
tk.color.selBg = gocui.AttrNone
|
2025-02-09 04:33:30 -06:00
|
|
|
|
|
|
|
tk.updateColor()
|
2025-02-07 02:34:40 -06:00
|
|
|
}
|
|
|
|
|
2025-02-07 03:09:16 -06:00
|
|
|
func (tk *guiWidget) setColorLabel() {
|
|
|
|
if tk.color == nil {
|
|
|
|
tk.color = new(colorT)
|
|
|
|
}
|
|
|
|
if me.dark {
|
|
|
|
tk.color.frame = gocui.AttrNone
|
|
|
|
tk.color.fg = gocui.ColorWhite
|
|
|
|
tk.color.bg = gocui.ColorBlack
|
|
|
|
tk.color.selFg = gocui.ColorWhite
|
|
|
|
tk.color.selBg = gocui.AttrNone
|
2025-02-09 04:33:30 -06:00
|
|
|
tk.updateColor()
|
2025-02-07 03:09:16 -06:00
|
|
|
return
|
|
|
|
}
|
|
|
|
tk.color.frame = gocui.AttrNone
|
|
|
|
tk.color.fg = gocui.ColorBlack
|
|
|
|
tk.color.bg = gocui.AttrNone
|
|
|
|
tk.color.selFg = gocui.AttrNone
|
2025-02-08 15:16:41 -06:00
|
|
|
tk.color.selBg = gocui.ColorWhite
|
2025-02-09 04:33:30 -06:00
|
|
|
|
|
|
|
tk.updateColor()
|
2025-02-07 03:09:16 -06:00
|
|
|
}
|
|
|
|
|
2025-02-07 02:34:40 -06:00
|
|
|
func (tk *guiWidget) setColorButtonDense() {
|
|
|
|
if tk.color == nil {
|
|
|
|
tk.color = new(colorT)
|
|
|
|
}
|
|
|
|
if me.dark {
|
|
|
|
tk.color.frame = gocui.AttrNone
|
|
|
|
tk.color.fg = gocui.ColorBlue
|
2025-02-07 03:09:16 -06:00
|
|
|
tk.color.bg = gocui.ColorBlack
|
2025-02-07 02:34:40 -06:00
|
|
|
tk.color.selFg = gocui.ColorWhite
|
|
|
|
tk.color.selBg = gocui.ColorBlue
|
2025-02-09 04:33:30 -06:00
|
|
|
tk.updateColor()
|
2025-02-07 02:34:40 -06:00
|
|
|
return
|
|
|
|
}
|
|
|
|
tk.color.frame = gocui.AttrNone
|
2025-02-08 13:57:31 -06:00
|
|
|
tk.color.fg = gocui.ColorWhite
|
|
|
|
tk.color.bg = gocui.ColorBlue
|
|
|
|
tk.color.selFg = gocui.ColorBlue
|
|
|
|
tk.color.selBg = gocui.AttrNone
|
2025-02-09 04:33:30 -06:00
|
|
|
|
|
|
|
tk.updateColor()
|
2025-02-07 02:34:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (tk *guiWidget) setColorButton() {
|
|
|
|
if tk.color == nil {
|
|
|
|
tk.color = new(colorT)
|
|
|
|
}
|
|
|
|
if me.dark {
|
2025-02-07 03:09:16 -06:00
|
|
|
tk.color.frame = gocui.ColorBlack
|
|
|
|
tk.color.fg = gocui.ColorBlue
|
|
|
|
tk.color.bg = gocui.ColorBlack
|
2025-02-07 02:34:40 -06:00
|
|
|
tk.color.selFg = gocui.ColorWhite
|
|
|
|
tk.color.selBg = gocui.ColorBlue
|
2025-02-09 04:33:30 -06:00
|
|
|
tk.updateColor()
|
2025-02-07 02:34:40 -06:00
|
|
|
return
|
|
|
|
}
|
|
|
|
tk.color.frame = gocui.ColorBlue
|
|
|
|
tk.color.fg = gocui.AttrNone
|
|
|
|
tk.color.bg = gocui.AttrNone
|
|
|
|
tk.color.selFg = gocui.ColorWhite
|
|
|
|
tk.color.selBg = gocui.ColorBlue
|
2025-02-09 04:33:30 -06:00
|
|
|
|
|
|
|
tk.updateColor()
|
2025-02-07 02:34:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (tk *guiWidget) setColorInput() {
|
|
|
|
if tk.color == nil {
|
|
|
|
tk.color = new(colorT)
|
|
|
|
}
|
|
|
|
if me.dark {
|
|
|
|
tk.color.frame = gocui.ColorYellow
|
|
|
|
tk.color.fg = gocui.AttrNone
|
|
|
|
tk.color.bg = gocui.AttrNone
|
|
|
|
tk.color.selFg = gocui.ColorYellow
|
|
|
|
tk.color.selBg = gocui.ColorBlack
|
2025-02-09 04:33:30 -06:00
|
|
|
tk.updateColor()
|
2025-02-07 02:34:40 -06:00
|
|
|
return
|
|
|
|
}
|
|
|
|
tk.color.frame = gocui.ColorYellow
|
|
|
|
tk.color.fg = gocui.AttrNone
|
|
|
|
tk.color.bg = gocui.AttrNone
|
|
|
|
tk.color.selFg = gocui.ColorYellow
|
|
|
|
tk.color.selBg = gocui.ColorBlack
|
2025-02-09 04:33:30 -06:00
|
|
|
tk.updateColor()
|
2025-02-07 02:34:40 -06:00
|
|
|
}
|
2025-02-08 15:01:36 -06:00
|
|
|
|
|
|
|
func (tk *guiWidget) setColorModal() {
|
|
|
|
if tk.color == nil {
|
|
|
|
tk.color = new(colorT)
|
|
|
|
}
|
|
|
|
if me.dark {
|
|
|
|
tk.color.frame = gocui.ColorRed
|
|
|
|
tk.color.fg = gocui.ColorRed
|
|
|
|
tk.color.bg = gocui.ColorBlack
|
|
|
|
tk.color.selFg = gocui.ColorBlack
|
|
|
|
tk.color.selBg = gocui.AttrNone
|
2025-02-09 04:33:30 -06:00
|
|
|
tk.updateColor()
|
2025-02-08 15:01:36 -06:00
|
|
|
return
|
|
|
|
}
|
|
|
|
tk.color.frame = gocui.ColorRed
|
|
|
|
tk.color.fg = gocui.AttrNone
|
|
|
|
tk.color.bg = gocui.AttrNone
|
|
|
|
tk.color.selFg = gocui.AttrNone
|
2025-02-08 15:16:41 -06:00
|
|
|
tk.color.selBg = gocui.ColorWhite
|
2025-02-09 04:33:30 -06:00
|
|
|
tk.updateColor()
|
2025-02-08 15:01:36 -06:00
|
|
|
}
|