mirror of
https://github.com/kaaninchen/Laterna.git
synced 2026-09-17 19:12:48 +00:00
🐛 fix(utils.go): check if hex-code starts with an #
This commit is contained in:
+1
-1
@@ -26,7 +26,7 @@ func IDtoInt(id string) (int, error) {
|
||||
}
|
||||
|
||||
func IsValidHexColor(color string) bool {
|
||||
pattern := `^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$`
|
||||
pattern := `^#(?:[A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$`
|
||||
match, _ := regexp.MatchString(pattern, color)
|
||||
return match
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user