name-color: example

This commit is contained in:
mehbark 2024-07-11 18:39:36 -04:00
parent 42b1b4ecc0
commit c7aba3042b

View file

@ -7,8 +7,9 @@ import * as css from "https://deno.land/x/css@0.3.0/mod.ts";
function is_valid_color(color: string): boolean {
try {
const { stylesheet } = css.parse(`*{color:${color};}`);
return stylesheet.rules.length == 1 &&
stylesheet.rules[0].declarations.length == 1;
return color.toLowerCase() != "example"
&& stylesheet.rules.length == 1
&& stylesheet.rules[0].declarations.length == 1;
} catch {
return false;
}