name-color: example
This commit is contained in:
parent
42b1b4ecc0
commit
c7aba3042b
1 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue