diff --git a/config/plugin.config.ts b/config/plugin.config.ts index e142565dd9e2684b16fca55626b5cd0d0f15ce09..1bef947ea0fc9e9d92d1dbe5c3ae35e31394dca5 100644 --- a/config/plugin.config.ts +++ b/config/plugin.config.ts @@ -46,7 +46,7 @@ export default (config: any) => { fileName: 'css/theme-colors.css', matchColors: getAntdSerials('#1890ff'), // 主色系列 // 改变样式选择器,解决样式覆盖问题 - changeSelector(selector) { + changeSelector(selector: string) { switch (selector) { case '.ant-calendar-today .ant-calendar-date': return ':not(.ant-calendar-selected-date)' + selector; @@ -103,10 +103,12 @@ export default (config: any) => { }); }; -function getAntdSerials(color) { +const getAntdSerials = (color: string) => { + const lightNum = 9; + const devide10 = 10; // 淡化(即less的tint) - const lightens = new Array(9).fill().map((t, i) => { - return ThemeColorReplacer.varyColor.lighten(color, i / 10); + const lightens = new Array(lightNum).fill().map((t, i) => { + return ThemeColorReplacer.varyColor.lighten(color, i / devide10); }); const colorPalettes = generate(color); return lightens.concat(colorPalettes); diff --git a/src/models/setting.ts b/src/models/setting.ts index 2b8e4a1d6d7866c8593ee5987d9e845781b7cbd0..2ba1469ec26ab9c7e04a5afad1ebe019fbe3b459 100644 --- a/src/models/setting.ts +++ b/src/models/setting.ts @@ -12,9 +12,11 @@ export interface SettingModelType { }; } -const updateTheme = (newPrimaryColor:string) => { - const hideMessage = message.loading('正在切换主题!', 0); - themeColorClient.changeColor(newPrimaryColor).finally(() => hideMessage()); +const updateTheme = (newPrimaryColor?: string) => { + const timeOut = 0; + const hideMessage = message.loading('正在切换主题!', timeOut); + themeColorClient.changeColor(newPrimaryColor) + .finally(() => hideMessage()); }; /*