Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion utils/parse-css-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,19 @@ const parseColorVariables = (
return;
}

const colorValue = processColorValue(value);
const trimmedValue = value.trim();
const valueWithoutImportant = trimmedValue.replace(/\s*!important$/i, "");

// Skip CSS variable references (var(...)) as they can't be processed as colors
if (
valueWithoutImportant.toLowerCase().startsWith("var(") &&
valueWithoutImportant.endsWith(")")
) {
console.warn(`Skipping CSS variable reference: ${cleanName}: ${trimmedValue}`);
return;
}

const colorValue = processColorValue(valueWithoutImportant);
const formattedValue = colorFormatter(colorValue, "hex");
target[cleanName as keyof ThemeStyleProps] = formattedValue;
}
Expand Down