diff --git a/src/index.ts b/src/index.ts index 9681acb..88da47c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -70,14 +70,18 @@ export function presetTheme>(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, } } @@ -104,7 +108,7 @@ export function presetTheme>(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 {