mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-29 03:41:35 +00:00
fix: 修复修改主题颜色以后button hover颜色不一致问题
This commit is contained in:
parent
24e716df5d
commit
45852eb4b9
@ -1,4 +1,4 @@
|
|||||||
import { generateColors, changeSidebarColor } from './color'
|
import { generateColors, changeSidebarColor, mix } from './color'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import formula from './formula.json'
|
import formula from './formula.json'
|
||||||
import variables from '@/styles/var.scss'
|
import variables from '@/styles/var.scss'
|
||||||
@ -10,14 +10,22 @@ export function writeNewStyle(themeColor) {
|
|||||||
let colorsCssText = ''
|
let colorsCssText = ''
|
||||||
let cssText = originalStyle
|
let cssText = originalStyle
|
||||||
const colors = generateColors(themeColor)
|
const colors = generateColors(themeColor)
|
||||||
Object.keys(colors).forEach((key) => {
|
for (const [key, value] of Object.entries(colors)) {
|
||||||
cssText = cssText.replace(new RegExp('(:|\\s+)' + key, 'g'), '$1' + `${colors[key]}`)
|
const blendColor = mix('ffffff', value.replace(/#/g, ''), 35)
|
||||||
|
cssText = cssText.replace(new RegExp('(:|\\s+)' + key, 'g'), '$1' + `${value}`)
|
||||||
colorsCssText += `
|
colorsCssText += `
|
||||||
.color-${key}{color: ${colors[key]}!important;}
|
.color-${key}{color: ${value}!important;}
|
||||||
.bg-${key}{background-color: ${colors[key]}!important;}
|
.bg-${key}{background-color: ${value}!important;}
|
||||||
.border-${key}{border-color: ${colors[key]}!important;}
|
.border-${key}{border-color: ${value}!important;}
|
||||||
|
.el-button--${key}.is-disabled,
|
||||||
|
.el-button--${key}.is-disabled:active,
|
||||||
|
.el-button--${key}.is-disabled:focus,
|
||||||
|
.el-button--${key}:hover{
|
||||||
|
background-color: ${blendColor}!important;
|
||||||
|
border-color: ${blendColor}!important;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
})
|
}
|
||||||
|
|
||||||
let styleTag = document.getElementById('themeStyle')
|
let styleTag = document.getElementById('themeStyle')
|
||||||
if (!styleTag) {
|
if (!styleTag) {
|
||||||
|
Loading…
Reference in New Issue
Block a user