add ansi and change sort call

This commit is contained in:
2022-03-31 11:28:10 -07:00
parent b87628ea88
commit 419a90f4ff
3 changed files with 62 additions and 7 deletions

View File

@@ -141,13 +141,24 @@ var spectrum = map[string]simplecolor.NamedPalette{
"blueGrey": blueGrey,
}
func GetPalette() (colors simplecolor.SimplePalette) {
for _, cp := range spectrum {
for _, c := range cp {
colors = append(colors, c)
}
}
sort.Sort(colors)
return
}
func GetColorsForShade(shade string) (colors simplecolor.SimplePalette) {
for _, cp := range spectrum {
if hue, ok := cp[shade]; ok {
colors = append(colors, hue)
sort.Sort(colors)
}
}
sort.Sort(colors)
return
}
@@ -155,8 +166,8 @@ func GetShadesForColorName(color string) (colors simplecolor.SimplePalette) {
if c, ok := spectrum[color]; ok {
for _, cp := range c {
colors = append(colors, cp)
sort.Sort(colors)
}
}
sort.Sort(colors)
return
}