lib/parsecolor: add "none" and "transparent"

This commit is contained in:
Nigel Tao committed 2026-05-02 11:11:06 +10:00
1 parent 30ac5c2e89
commit 40cf8c0ad1
3 files changed
+13 -2

No files matched your search

+4 -1
View File
@@ -50,7 +50,10 @@ func Parse(s string) (nrgba color.NRGBA, ok bool) {
if !startsWithHash {
adjustment, p, n := 0, 0, len(s)
if string(buf[:4]) == "dark" {
if ((n == 4) && (string(buf[:4]) == "none")) ||
((n == 11) && (string(buf[:11]) == "transparent")) {
return color.NRGBA{}, true
} else if string(buf[:4]) == "dark" {
adjustment = 1
p += 4
n -= 4