Skip to content

Commit

Permalink
wip: added quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
arfedulov committed Jun 13, 2024
1 parent 15a9789 commit eca334b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,18 @@ export function presetTheme<T extends Record<string, any>>(options: PresetThemeO
let themeValue
= getThemeVal(theme[key], themeKeys, index)
|| (key === originalThemeKey ? getThemeVal(originalTheme, themeKeys) : null)
let themeAlphaValue = '1'
if (themeValue) {
if (isColor) {
const cssColor = parseCssColor(themeValue)
if (cssColor?.alpha !== undefined && cssColor?.alpha !== null)
themeAlphaValue = `${cssColor.alpha}`
if (cssColor?.components)
themeValue = cssColor.components.join(' ')
}
obj[key] = {
[name]: themeValue,
[`${name}--alpha`]: themeAlphaValue,
}
}

Expand All @@ -104,7 +108,7 @@ export function presetTheme<T extends Record<string, any>>(options: PresetThemeO
if (isColor) {
const cssColor = parseCssColor(val) || val
if (typeof cssColor !== 'string')
curTheme[key] = wrapCSSFunction(cssColor.type, curTheme[key], cssColor?.alpha)
curTheme[key] = wrapCSSFunction(cssColor.type, curTheme[key], wrapVar(`${name}--alpha`))
}
}
else {
Expand Down

0 comments on commit eca334b

Please sign in to comment.