Commit 867301ac authored by hz's avatar hz

解决样式覆盖问题;解决@keyframe内颜色替换无效问题

parent c83a1d89
...@@ -44,15 +44,22 @@ export default config => { ...@@ -44,15 +44,22 @@ export default config => {
config.plugin('webpack-theme-color-replacer').use(ThemeColorReplacer, [ config.plugin('webpack-theme-color-replacer').use(ThemeColorReplacer, [
{ {
fileName: 'css/theme-colors.css', fileName: 'css/theme-colors.css',
matchColors: generate('#1890ff'), // 主色系列 matchColors: getAntdSerials('#1890ff'), // 主色系列
// 改变样式选择器,解决样式覆盖问题 // 改变样式选择器,解决样式覆盖问题
changeSelector(selector) { changeSelector(selector) {
switch (selector) { var fix = {
case '.ant-calendar-today .ant-calendar-date': '.ant-calendar-today .ant-calendar-date':
return ':not(.ant-calendar-selected-day)' + selector; ':not(.ant-calendar-selected-date)' + selector,
default: '.ant-btn:focus,.ant-btn:hover': selector
return selector; .split(',')
} .map(s => s + ':not(.ant-btn-primary)')
.join(','),
'.ant-btn.active,.ant-btn:active': selector
.split(',')
.map(s => s + ':not(.ant-btn-primary)')
.join(','),
};
return fix[selector] || selector;
}, },
}, },
]); ]);
...@@ -97,3 +104,12 @@ export default config => { ...@@ -97,3 +104,12 @@ export default config => {
}, },
}); });
}; };
function getAntdSerials(color) {
const colorPalettes = generate(color);
// 淡化(即less的tint)
const lightens = new Array(9).fill().map((t, i) => {
return ThemeColorReplacer.varyColor.lighten(color, i / 10);
});
return colorPalettes.concat(lightens);
}
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
"tslint-config-prettier": "^1.17.0", "tslint-config-prettier": "^1.17.0",
"tslint-react": "^3.6.0", "tslint-react": "^3.6.0",
"umi-plugin-ga": "^1.1.3", "umi-plugin-ga": "^1.1.3",
"webpack-theme-color-replacer": "^1.1.4" "webpack-theme-color-replacer": "^1.1.5"
}, },
"optionalDependencies": { "optionalDependencies": {
"puppeteer": "^1.12.1" "puppeteer": "^1.12.1"
......
...@@ -5,7 +5,12 @@ import client from 'webpack-theme-color-replacer/client'; ...@@ -5,7 +5,12 @@ import client from 'webpack-theme-color-replacer/client';
export default { export default {
primaryColor: '#1890ff', primaryColor: '#1890ff',
getAntdSerials(color) { getAntdSerials(color) {
return generate(color); // 淡化(即less的tint)
const lightens = new Array(9).fill().map((t, i) => {
return client.varyColor.lighten(color, i / 10);
});
const colorPalettes = generate(color);
return lightens.concat(colorPalettes);
}, },
changeColor(newColor) { changeColor(newColor) {
const lastColor = this.lastColor || this.primaryColor; const lastColor = this.lastColor || this.primaryColor;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment