|
@@ -1,6 +1,7 @@
|
|
import { defineStore } from 'pinia'
|
|
import { defineStore } from 'pinia'
|
|
import { store } from '../index'
|
|
import { store } from '../index'
|
|
import { setCssVar, humpToUnderline } from '@/utils'
|
|
import { setCssVar, humpToUnderline } from '@/utils'
|
|
|
|
+import { mix } from '@/utils/color'
|
|
import { ElMessage, ComponentSize } from 'element-plus'
|
|
import { ElMessage, ComponentSize } from 'element-plus'
|
|
|
|
|
|
interface AppState {
|
|
interface AppState {
|
|
@@ -239,6 +240,7 @@ export const useAppStore = defineStore('app', {
|
|
document.documentElement.classList.add('light')
|
|
document.documentElement.classList.add('light')
|
|
document.documentElement.classList.remove('dark')
|
|
document.documentElement.classList.remove('dark')
|
|
}
|
|
}
|
|
|
|
+ this.setPrimaryLight()
|
|
},
|
|
},
|
|
setCurrentSize(currentSize: ComponentSize) {
|
|
setCurrentSize(currentSize: ComponentSize) {
|
|
this.currentSize = currentSize
|
|
this.currentSize = currentSize
|
|
@@ -253,9 +255,21 @@ export const useAppStore = defineStore('app', {
|
|
for (const key in this.theme) {
|
|
for (const key in this.theme) {
|
|
setCssVar(`--${humpToUnderline(key)}`, this.theme[key])
|
|
setCssVar(`--${humpToUnderline(key)}`, this.theme[key])
|
|
}
|
|
}
|
|
|
|
+ this.setPrimaryLight()
|
|
},
|
|
},
|
|
setFooter(footer: boolean) {
|
|
setFooter(footer: boolean) {
|
|
this.footer = footer
|
|
this.footer = footer
|
|
|
|
+ },
|
|
|
|
+ setPrimaryLight() {
|
|
|
|
+ if (this.theme.elColorPrimary) {
|
|
|
|
+ const elColorPrimary = this.theme.elColorPrimary
|
|
|
|
+ const color = this.isDark ? '#000000' : '#ffffff'
|
|
|
|
+ const lightList = [3, 5, 7, 8, 9]
|
|
|
|
+ lightList.forEach((v) => {
|
|
|
|
+ setCssVar(`--el-color-primary-light-${v}`, mix(color, elColorPrimary, v / 10))
|
|
|
|
+ })
|
|
|
|
+ setCssVar(`--el-color-primary-dark-2`, mix(color, elColorPrimary, 0.2))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
persist: true
|
|
persist: true
|