# antd-design-angular-theme-generator **Repository Path**: EightDoor/antd-design-angular-theme-generator ## Basic Information - **Project Name**: antd-design-angular-theme-generator - **Description**: ant-design-angular 动态主题生成 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-08-27 - **Last Updated**: 2022-06-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # antd-theme-generator This script generates color specific styles/less file which you can use to change theme dynamically in browser ## Example: ``` const { generateTheme } = require('antd-theme-generator'); const options = { antDir: path.join(__dirname, './node_modules/antd'), stylesDir: path.join(__dirname, './src/styles'), varFile: path.join(__dirname, './src/styles/variables.less'), // default path is Ant Design default.less file mainLessFile: path.join(__dirname, './src/styles/index.less'), themeVariables: ['@primary-color'], outputFilePath: path.join(__dirname, './public/color.less') // if provided, file will be created with generated less/styles } generateTheme(options).then(less => { console.log('Theme generated successfully'); }) .catch(error => { console.log('Error', error); }) ``` ## Note: include all color variables in `varFile` that you want to change dynamically and assign them unique color codes. Don't assign same color to two or more variables and don't use `#fff`, `#ffffff`, `#000` or `#000000`. If you still want white or black color as default, slightly change it e.g. `#fffffe` or `#000001` which will not replace common background colors from other components. Add following lines in your main html file ``` ``` Now you can update colors by updating less variables like this ``` window.less.modifyVars({ '@primary-color': '#0035ff' }) ```