make 6 a valid length for hex colors

Also marks `isHexColor` as public function.
This commit is contained in:
Halil Durak
2025-11-12 18:47:39 +03:00
parent 0a705b15ce
commit 4872aabc87

View File

@@ -190,7 +190,7 @@ fn isNumericWithUnit(value: []const u8) bool {
return CSSKeywords.isValidUnit(unit); return CSSKeywords.isValidUnit(unit);
} }
fn isHexColor(value: []const u8) bool { pub fn isHexColor(value: []const u8) bool {
if (value.len == 0) { if (value.len == 0) {
return false; return false;
} }
@@ -199,7 +199,7 @@ fn isHexColor(value: []const u8) bool {
} }
const hex_part = value[1..]; const hex_part = value[1..];
if (hex_part.len != 3 and hex_part.len != 6 and hex_part.len != 8) { if (hex_part.len != 3 and hex_part.len != 4 and hex_part.len != 6 and hex_part.len != 8) {
return false; return false;
} }