Merge pull request #443 from GavinRay97/enhance-theme-support
Add ability to set skin colors by hex codemine
commit
a5c8ed0d2b
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue