diff --git a/src/utils/is-color.ts b/src/utils/is-color.ts index 71d325d..8bbaa0e 100644 --- a/src/utils/is-color.ts +++ b/src/utils/is-color.ts @@ -203,14 +203,13 @@ const IS_COLOR_FN = /^(rgba?|hsla?|hwb|color|(ok)?(lab|lch)|light-dark|color-mix export function isColor(value: string, theme?: CustomThemeConfig): boolean { if (!value) return false - let isThemeColor = false - - if (theme) { - const [trueValue,] = segment(value, '/') - isThemeColor = !!trueValue.split('-').reduce((acc, val) => acc[val], theme.colors as any); - } + const isThemeColor = + theme && + !!segment(value, "/")?.[0] + .split("-") + .reduce((acc, val) => acc[val], theme.colors as any); return ( value.charCodeAt(0) === HASH || IS_COLOR_FN.test(value) || NAMED_COLORS.has(value.toLowerCase()) || isThemeColor ) -} \ No newline at end of file +}