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
|
||||
EightBitColor
|
||||
TrueColor
|
||||
Term // more or less no color added
|
||||
)
|
||||
|
||||
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",
|
||||
"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) {
|
||||
switch kind {
|
||||
case SimpleColor, EightBitColor, TrueColor:
|
||||
case SimpleColor, EightBitColor, TrueColor, Term:
|
||||
s.Mode = kind
|
||||
default:
|
||||
ct := os.Getenv("COLORTERM")
|
||||
|
|
4
main.go
4
main.go
|
@ -216,13 +216,15 @@ func SetColorFromFlag(f string) int {
|
|||
return EightBitColor
|
||||
case "TRUE":
|
||||
return TrueColor
|
||||
case "NONE", "OFF":
|
||||
return Term
|
||||
default:
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
colors := flag.String("color", "", "Color mode: 8, 256, or TRUE" )
|
||||
colors := flag.String("color", "", "Color mode: 8, 256, True, None" )
|
||||
flag.Parse()
|
||||
args := flag.Args()
|
||||
style.Init(SetColorFromFlag(*colors))
|
||||
|
|
Loading…
Reference in New Issue