You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
953 B
JavaScript
26 lines
953 B
JavaScript
// 动态更新antd主题颜色
|
|
const path = require('path');
|
|
const { generateTheme } = require('antd-theme-generator');
|
|
const options = {
|
|
antDir: path.join(__dirname, './node_modules/ant-design-vue'), //依赖位置
|
|
// stylesDir: path.join(__dirname, './src/style'), //处理style下所有less
|
|
varFile: path.join(__dirname, './src/style/antd-variables.less'), //antd全局变量
|
|
themeVariables: [
|
|
'@primary-color',
|
|
'@secondary-color',
|
|
'@text-color',
|
|
'@text-color-secondary',
|
|
'@heading-color',
|
|
'@layout-body-background',
|
|
'@btn-primary-bg',
|
|
'@layout-header-background'
|
|
], // 指定所有我们自定义的需要切换的样式变量。
|
|
outputFilePath: path.join(__dirname, './public/antd_color.less'), // 输出样式
|
|
}
|
|
generateTheme(options).then(() => {
|
|
console.log('Theme generated successfully');
|
|
}).catch(error => {
|
|
console.log('Error', error);
|
|
});
|
|
|