perf: 修改 detail card

This commit is contained in:
ibuler
2024-05-23 18:26:36 +08:00
parent 23f6502d99
commit 5996d89e4c
9 changed files with 51 additions and 37 deletions

View File

@@ -90,22 +90,20 @@ export function changeMenuColor(themeColors) {
colors['--menu-hover'] = mix(white, menuActiveTextColor.replace(/#/g, ''), 90)
}
const lights = [15, 40, 60, 80]
const darken = [15, 30, 40, 60]
const lights = [15, 40, 60, 80, 90]
const darken = [15, 30, 40, 60, 80]
for (const key in colors) {
const currentColor = colors[key]
elementStyle.setProperty(key, currentColor)
if (key === '--color-primary') {
for (const [i, light] of lights.entries()) {
const color = mix(white, currentColor.replace(/#/g, ''), light)
elementStyle.setProperty(key + '-light' + '-' + i, color)
}
for (const [i, dark] of darken.entries()) {
const color = mix(black, currentColor.replace(/#/g, ''), dark)
elementStyle.setProperty(key + '-dark' + '-' + i, color)
}
for (const [i, light] of lights.entries()) {
const color = mix(white, currentColor.replace(/#/g, ''), light)
elementStyle.setProperty(key + '-light' + '-' + i, color)
}
for (const [i, dark] of darken.entries()) {
const color = mix(black, currentColor.replace(/#/g, ''), dark)
elementStyle.setProperty(key + '-dark' + '-' + i, color)
}
if (key.includes('--color')) {

View File

@@ -47,6 +47,9 @@ export function changeElementColor(themeColors) {
.el-tag--dark.el-tag--${key} {
background-color: ${value} !important;
}
.el-alert.el-alert--${key}.is-light {
background-color: var(--color-${key}-light-4);
}
`
}
}