to lower on name2rgb

This commit is contained in:
Bernard Xie 2023-02-27 16:27:28 -08:00
parent b48c2b411f
commit 7c295c1942
No known key found for this signature in database
GPG key ID: 3C3E0036CE0F892C

View file

@ -5,6 +5,7 @@ import (
"math" "math"
"regexp" "regexp"
"strconv" "strconv"
"strings"
"github.com/lucasb-eyer/go-colorful" "github.com/lucasb-eyer/go-colorful"
"github.com/mazznoer/csscolorparser" "github.com/mazznoer/csscolorparser"
@ -337,7 +338,7 @@ var namedRgbMap = map[string][]uint8{
} }
func Name2RGB(name string) RGB { func Name2RGB(name string) RGB {
if rgb, ok := namedRgbMap[name]; ok { if rgb, ok := namedRgbMap[strings.ToLower(name)]; ok {
return RGB{ return RGB{
Red: rgb[0], Red: rgb[0],
Green: rgb[1], Green: rgb[1],