Add ability to set theme colors by hex code

mine
Gavin 2019-12-16 00:38:33 -05:00
parent a170cf5ff0
commit b8b3c9dc83
1 changed files with 5 additions and 2 deletions

View File

@ -329,7 +329,10 @@ func (s *Styles) Update() {
func AsColor(c string) tcell.Color {
if color, ok := tcell.ColorNames[c]; ok {
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
}