commit | author | age
|
9bcb19
|
1 |
import { message } from 'ant-design-vue/es' |
I |
2 |
import themeColor from './themeColor.js' |
|
3 |
|
|
4 |
const colorList = [ |
|
5 |
{ |
|
6 |
key: '薄暮', color: '#F5222D' |
|
7 |
}, |
|
8 |
{ |
|
9 |
key: '火山', color: '#FA541C' |
|
10 |
}, |
|
11 |
{ |
|
12 |
key: '日暮', color: '#FAAD14' |
|
13 |
}, |
|
14 |
{ |
|
15 |
key: '明青', color: '#13C2C2' |
|
16 |
}, |
|
17 |
{ |
|
18 |
key: '极光绿', color: '#52C41A' |
|
19 |
}, |
|
20 |
{ |
|
21 |
key: '拂晓蓝(默认)', color: '#1890FF' |
|
22 |
}, |
|
23 |
{ |
|
24 |
key: '极客蓝', color: '#2F54EB' |
|
25 |
}, |
|
26 |
{ |
|
27 |
key: '酱紫', color: '#722ED1' |
|
28 |
} |
|
29 |
] |
|
30 |
|
|
31 |
const updateTheme = newPrimaryColor => { |
|
32 |
const hideMessage = message.loading('正在切换主题!', 0) |
|
33 |
themeColor.changeColor(newPrimaryColor).finally(t => { |
|
34 |
setTimeout(() => { |
|
35 |
hideMessage() |
|
36 |
}, 10) |
|
37 |
}) |
|
38 |
} |
|
39 |
|
|
40 |
const updateColorWeak = colorWeak => { |
|
41 |
// document.body.className = colorWeak ? 'colorWeak' : ''; |
|
42 |
const app = document.body.querySelector('#app') |
|
43 |
colorWeak ? app.classList.add('colorWeak') : app.classList.remove('colorWeak') |
|
44 |
} |
|
45 |
|
|
46 |
export { updateTheme, colorList, updateColorWeak } |