GitOfZGT/vite-plugin-theme-preprocessor

setCustomTheme能否传入颜色变量名参数进行设置主题

Opened this issue · 0 comments

setCustomTheme参数格式:
const defaultPrimaryColor = "#CB38CE";
const defaultRadius = 4;
// 对应less变量 @alert-success-bg-color 的值,让它单独切换,不跟随主题色
const alertSuccessBgReplacerKey = "#F7D06B";
interface ThemeOpt {
primaryColor: string;
targetValueReplacer?: object;
gradientReplacer?: {
[alertSuccessBgReplacerKey]: string;
};
}
执行npx z-theme ins gradientReplacer可用属性:
{
gradientReplacer: { '#512da7': '#512da7', '#F7D06B': '#F7D06B', '#6A38C6': '#6A38C6' }
}
gradientReplacer属性名是在theme-vars中定义的变量的值:
@primary-color:#512da7;
@alert-success-bg-color:#F7D06B;
@alert-warning-bg-color:#6A38C6;
属性名能否用变量名(或驼峰变量名)而不是值:
{
gradientReplacer: {alert-success-bg-color: '#512da7', alert-success-bg-color: '#F7D06B', alert-warning-bg-color: '#6A38C6' }
}