vue-fluent-ui
Version:
一个winui3/fluent design风格的vue组件库
22 lines (17 loc) • 657 B
JavaScript
import { kebabCase } from "lodash";
;// CONCATENATED MODULE: external "lodash"
;// CONCATENATED MODULE: ./src/theme/createStyle.ts
/**
* 根据主题对象创建 CSS 变量样式字符串。
* @param {ThemeType} theme - 主题对象。
* @returns {string} - 返回一个包含所有 CSS 变量的样式字符串,用于注入到 style 标签中。
*/ const createStyle = (theme)=>{
const cssRules = [];
for(const type in theme){
for(const name in theme[type]){
cssRules.push(`--vf-${type}-${kebabCase(name)}: ${theme[type][name]}`);
}
}
return `html {${cssRules.join(';\n')}`;
};
export { createStyle };