ignore empty `content` when determining rule color

master
Brad Cornes 2021-06-15 20:39:53 +01:00
parent e2285c087c
commit 16864d96ae
1 changed files with 8 additions and 1 deletions

View File

@ -61,7 +61,14 @@ function getColorsInString(str: string): (TinyColor | KeywordColor)[] {
function getColorFromDecls(
decls: Record<string, string | string[]>
): TinyColor | KeywordColor | null {
let props = Object.keys(decls)
let props = Object.keys(decls).filter((prop) => {
// ignore content: "";
if (prop === 'content' && (decls[prop] === '""' || decls[prop] === "''")) {
return false
}
return true
})
if (props.length === 0) return null
const nonCustomProps = props.filter((prop) => !prop.startsWith('--'))