Skip to content

The only downloader you need. 下载器的集大成者。

feat(app): 优化 AcrylicMenu 暗黑模式显示效果

XiaoYouChR006bd9deab2d
diff --git a/app/components/custom_components.py b/app/components/custom_components.py
index de14d20f..5ddf47f0 100644
--- a/app/components/custom_components.py
+++ b/app/components/custom_components.py
@@ -1,3 +1,4 @@
+import darkdetect
from PySide6.QtCore import QSize, QRect, QTimer
from PySide6.QtGui import QPainter, Qt, QIcon
from PySide6.QtWidgets import QWidget, QHBoxLayout, QStyleFactory, QStyle, QProxyStyle, QMenu
@@ -5,6 +6,8 @@ from qfluentwidgets import BodyLabel, FluentIconBase, drawIcon, ProgressBar, Rou
from qfluentwidgets.components.widgets.menu import MenuActionListWidget
from qframelesswindow import WindowEffect
+from app.common.config import cfg
+
# 我是傻逼
# class DisabledRichTextEdit(TextEdit):
@@ -165,6 +168,6 @@ class CustomAcrylicMenu(RoundMenu):
self.windowEffect.addMenuShadowEffect(self.winId())
self.windowEffect.addShadowEffect(self.winId())
self.windowEffect.enableBlurBehindWindow(self.winId())
- self.windowEffect.setAcrylicEffect(self.winId())
+ self.windowEffect.setAcrylicEffect(self.winId(), "00000030" if (darkdetect.isDark() if cfg.customThemeMode.value == 'System' else cfg.customThemeMode.value == 'Dark') else "FFFFFF30")
super().showEvent(event)
diff --git a/app/view/main_window.py b/app/view/main_window.py
index 98d8c457..5e317c51 100644
--- a/app/view/main_window.py
+++ b/app/view/main_window.py
@@ -202,14 +202,7 @@ class MainWindow(MSFluentWindow):
if sys.platform == 'win32':
self.windowEffect.removeBackgroundEffect(self.winId())
- _ = cfg.customThemeMode.value
-
- if _ == 'System':
- _ = True if darkdetect.isDark() else False
- elif _ == 'Dark':
- _ = True
- elif _ == 'Light':
- _ = False
+ _ = darkdetect.isDark() if cfg.customThemeMode.value == 'System' else cfg.customThemeMode.value == 'Dark'
if cfg.backgroundEffect.value == 'Acrylic':
self.setStyleSheet("background-color: transparent")