Add ability to set theme colors by hex code
parent
a170cf5ff0
commit
b8b3c9dc83
|
|
@ -329,7 +329,10 @@ func (s *Styles) Update() {
|
||||||
func AsColor(c string) tcell.Color {
|
func AsColor(c string) tcell.Color {
|
||||||
if color, ok := tcell.ColorNames[c]; ok {
|
if color, ok := tcell.ColorNames[c]; ok {
|
||||||
return color
|
return color
|
||||||
|
} else {
|
||||||
|
// Use tcell.GetColor to support hex codes.
|
||||||
|
// "Creates a Color from a color name (W3C name). A hex value may be supplied as a string in the format "#ffffff"."
|
||||||
|
color := tcell.GetColor(c)
|
||||||
|
return color
|
||||||
}
|
}
|
||||||
|
|
||||||
return tcell.ColorPink
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue