fix: 修复element-ui,link标签hover状态的颜色

This commit is contained in:
“huailei000”
2022-07-08 14:27:04 +08:00
committed by 老广
parent bc9d0aeeb3
commit d25620ecfe

View File

@@ -10,14 +10,14 @@ export function changeElementColor(themeColors) {
let cssText = originalStyle
const colors = generateColors(themeColors)
for (const [key, value] of Object.entries(colors)) {
const blendColor = mix('ffffff', value.replace(/#/g, ''), 35)
cssText = cssText.replace(new RegExp('(:|\\s+)' + key, 'g'), '$1' + `${value}`)
colorsCssText += `
.color-${key}{color: ${value}!important;}
.bg-${key}{background-color: ${value}!important;}
.border-${key}{border-color: ${value}!important;}
.color-${key}{color: ${value}!important;}
.bg-${key}{background-color: ${value}!important;}
.border-${key}{border-color: ${value}!important;}
`
if (['primary', 'success', 'info', 'warning', 'danger'].includes(key)) {
const blendColor = mix('ffffff', value.replace(/#/g, ''), 35)
colorsCssText = colorsCssText + `
.el-button--${key}:focus {
background-color: ${value}!important;
@@ -30,6 +30,9 @@ export function changeElementColor(themeColors) {
background-color: ${blendColor}!important;
border-color: ${blendColor}!important;
}
.el-link.el-link--${key}:hover {
color: ${blendColor}!important;
}
`
}
}