chore: optimize the code of theme color; 🌟

This commit is contained in:
chenghongxing
2020-07-22 19:47:16 +08:00
parent ad0b2bda34
commit a62c293e42
6 changed files with 23 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
const varyColor = require('webpack-theme-color-replacer/client/varyColor')
const generate = require('@ant-design/colors/lib/generate').default
const {ADMIN, ANTD} = require('../config/default')
const Config = require('../config')
const themeMode = ADMIN.theme.mode
@@ -13,7 +14,11 @@ function getAntdColors(color, mode) {
// 获取功能性颜色
function getFunctionalColors(mode) {
let options = mode && (mode == themeMode.NIGHT) ? {theme: 'dark'} : undefined
const {success, warning, error} = ANTD.primary
let {success, warning, error} = ANTD.primary
const {success: s1, warning: w1, error: e1} = Config.theme
success = success && s1
warning = success && w1
error = success && e1
const successColors = generate(success, options)
const warningColors = generate(warning, options)
const errorColors = generate(error, options)