diff --git a/src/components/setting/Setting.vue b/src/components/setting/Setting.vue index 97c0f96..99656dd 100644 --- a/src/components/setting/Setting.vue +++ b/src/components/setting/Setting.vue @@ -8,14 +8,14 @@ - - - - - - - - + + + + + + + + diff --git a/src/utils/themeUtil.js b/src/utils/themeUtil.js index dda691b..3cfcbf5 100644 --- a/src/utils/themeUtil.js +++ b/src/utils/themeUtil.js @@ -1,14 +1,23 @@ -import client from 'webpack-theme-color-replacer/client' -import generate from '@ant-design/colors/lib/generate' +const ThemeColorReplacer = require('webpack-theme-color-replacer') +const client = require('webpack-theme-color-replacer/client') +const generate = require('@ant-design/colors/lib/generate').default -export default { +module.exports = { primaryColor: '#1890ff', + getThemeColors(color) { + const lightens = new Array(9).fill().map((t, i) => { + return ThemeColorReplacer.varyColor.lighten(color, i / 10) + }) + const palettes = generate(color) + const rgb = ThemeColorReplacer.varyColor.toNum3(color.replace('#', '')).join(',') + return palettes.concat(lightens).concat(rgb) + }, changeThemeColor (newColor) { let lastColor = this.lastColor || this.primaryColor let options = { cssUrl: '/css/theme-colors.css', - oldColors: generate(lastColor), - newColors: generate(newColor) + oldColors: this.getThemeColors(lastColor), + newColors: this.getThemeColors(newColor) } let promise = client.changer.changeColor(options) this.lastColor = lastColor diff --git a/static/.gitkeep b/static/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/static/favicon.icon b/static/favicon.icon deleted file mode 100644 index 3aaca2c..0000000 Binary files a/static/favicon.icon and /dev/null differ diff --git a/static/img/preview.jpg b/static/img/preview.jpg deleted file mode 100644 index 6ffab0f..0000000 Binary files a/static/img/preview.jpg and /dev/null differ diff --git a/static/img/vue-antd-logo.png b/static/img/vue-antd-logo.png deleted file mode 100644 index bbdbbfd..0000000 Binary files a/static/img/vue-antd-logo.png and /dev/null differ diff --git a/vue.config.js b/vue.config.js index d333db6..494f41b 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,6 +1,6 @@ // let path = require('path') const ThemeColorReplacer = require('webpack-theme-color-replacer') -const generate = require('@ant-design/colors/lib/generate').default +const getThemeColors = require('./src/utils/themeUtil').getThemeColors module.exports = { pluginOptions: { @@ -15,7 +15,7 @@ module.exports = { config.plugins.push( new ThemeColorReplacer({ fileName: 'css/theme-colors.css', - matchColors: generate('#1890ff') + matchColors: getThemeColors('#1890ff') }) ) },