Skip to content

Commit 0f9e519

Browse files
committed
feature:调整侧边栏暗夜模式的hover错误
1 parent 0d17a23 commit 0f9e519

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

web/src/utils/format.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ const generateAllColors = (u,e)=> {
7777
}
7878

7979

80+
81+
function addOpacityToColor(u, opacity) {
82+
let t = colorToHex(u);
83+
return `rgba(${t[0]}, ${t[1]}, ${ t[2]}, ${opacity})`;
84+
}
85+
86+
8087
export const setBodyPrimaryColor = ( primaryColor ) =>{
8188
document.documentElement.style.setProperty('--el-color-primary', primaryColor)
8289
for (let times = 1; times <= 2; times++) {
@@ -85,5 +92,5 @@ export const setBodyPrimaryColor = ( primaryColor ) =>{
8592
for (let times = 1; times <= 10; times++) {
8693
document.documentElement.style.setProperty(`--el-color-primary-light-${times}`, generateAllColors(primaryColor, times / 10))
8794
}
88-
95+
document.documentElement.style.setProperty(`--el-menu-hover-bg-color`, addOpacityToColor(primaryColor, 0.1))
8996
}

web/src/view/layout/aside/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div
3-
class=" relative h-full bg-white text-slate-700 dark:text-slate-300 dark:bg-slate-900 border-r shadow dark:shadow-gray-700"
3+
class="relative h-full bg-white text-slate-700 dark:text-slate-300 dark:bg-slate-900 border-r shadow dark:shadow-gray-700"
44
:class="isCollapse ? '' : ' px-2'"
55
:style="{
66
width : layoutSideWidth + 'px',

0 commit comments

Comments
 (0)