Merge pull request #443 from GavinRay97/enhance-theme-support

Add ability to set skin colors by hex code
mine
Fernand Galiana 2019-12-28 20:59:57 -07:00 committed by GitHub
commit a5c8ed0d2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -327,9 +327,10 @@ func (s *Styles) Update() {
// AsColor checks color index, if match return color otherwise pink it is.
func AsColor(c string) tcell.Color {
if color, ok := tcell.ColorNames[c]; ok {
// 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"."
if color := tcell.GetColor(c); color != -1 {
return color
}
return tcell.ColorPink
}