Adds mode for removing colors
This commit is contained in:
parent
1a235c3ecd
commit
67eae4866c
11
colors.go
11
colors.go
|
@ -9,6 +9,7 @@ const (
|
||||||
SimpleColor int = iota
|
SimpleColor int = iota
|
||||||
EightBitColor
|
EightBitColor
|
||||||
TrueColor
|
TrueColor
|
||||||
|
Term // more or less no color added
|
||||||
)
|
)
|
||||||
|
|
||||||
type Styles struct {
|
type Styles struct {
|
||||||
|
@ -49,11 +50,19 @@ var colors = map[int]map[string]string{
|
||||||
"LaneSelected": "\033[38;2;25;25;25m\033[48;2;255;184;16m",
|
"LaneSelected": "\033[38;2;25;25;25m\033[48;2;255;184;16m",
|
||||||
"Input": "\033[38;2;25;25;25m\033[48;2;253;244;220m",
|
"Input": "\033[38;2;25;25;25m\033[48;2;253;244;220m",
|
||||||
},
|
},
|
||||||
|
Term: map[string]string{
|
||||||
|
"Header": "",
|
||||||
|
"Message": "",
|
||||||
|
"MessageErr": "",
|
||||||
|
"Lane": "",
|
||||||
|
"LaneSelected": "",
|
||||||
|
"Input": "",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Styles) SetColorMode(kind int) {
|
func (s *Styles) SetColorMode(kind int) {
|
||||||
switch kind {
|
switch kind {
|
||||||
case SimpleColor, EightBitColor, TrueColor:
|
case SimpleColor, EightBitColor, TrueColor, Term:
|
||||||
s.Mode = kind
|
s.Mode = kind
|
||||||
default:
|
default:
|
||||||
ct := os.Getenv("COLORTERM")
|
ct := os.Getenv("COLORTERM")
|
||||||
|
|
4
main.go
4
main.go
|
@ -216,13 +216,15 @@ func SetColorFromFlag(f string) int {
|
||||||
return EightBitColor
|
return EightBitColor
|
||||||
case "TRUE":
|
case "TRUE":
|
||||||
return TrueColor
|
return TrueColor
|
||||||
|
case "NONE", "OFF":
|
||||||
|
return Term
|
||||||
default:
|
default:
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
colors := flag.String("color", "", "Color mode: 8, 256, or TRUE" )
|
colors := flag.String("color", "", "Color mode: 8, 256, True, None" )
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
args := flag.Args()
|
args := flag.Args()
|
||||||
style.Init(SetColorFromFlag(*colors))
|
style.Init(SetColorFromFlag(*colors))
|
||||||
|
|
Loading…
Reference in New Issue