From 6c8f6f4424e455e2d34dcee5758aad28b76aa3e6 Mon Sep 17 00:00:00 2001 From: Gavin Date: Mon, 16 Dec 2019 14:06:12 -0500 Subject: [PATCH] Refactor AsColor change to have catch-all default to pass test suite --- internal/config/style.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/internal/config/style.go b/internal/config/style.go index c9e5ebf8..63c40add 100644 --- a/internal/config/style.go +++ b/internal/config/style.go @@ -327,12 +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 { - 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) + // 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 }