Skip to content

Commit 8967ddf

Browse files
committed
Add log on error
1 parent 6615637 commit 8967ddf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/bin/css_to_ts/colorOptions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ export function parseColorOptions(rawCssCode: string): ColorOption[] {
359359

360360
return declarations
361361
.map(({ property: colorName, value: color }: any) => {
362-
const htmlColorRegexp = /^#[0-9a-f]{6}$/;
362+
const htmlColorRegexp = /^#[0-9a-f]{3,6}$/;
363363

364364
if (!htmlColorRegexp.test(color)) {
365365
return undefined;
@@ -372,7 +372,7 @@ export function parseColorOptions(rawCssCode: string): ColorOption[] {
372372
)?.value;
373373

374374
assert(typeof colorDark === "string");
375-
assert(htmlColorRegexp.test(colorDark));
375+
assert(htmlColorRegexp.test(colorDark), `${colorDark} doesn't seem to be a color`);
376376

377377
if (parsedName.brightness.isInvariant) {
378378
assert(color === colorDark);

0 commit comments

Comments
 (0)