diff --git a/qt/aqt/switch.py b/qt/aqt/switch.py index e8d835d8a..cd594911d 100644 --- a/qt/aqt/switch.py +++ b/qt/aqt/switch.py @@ -102,7 +102,11 @@ class Switch(QAbstractButton): ) def _paint_knob(self, painter: QPainter) -> None: - painter.setBrush(QBrush(theme_manager.qcolor(colors.FRAME_BG))) + if theme_manager.night_mode: + color = QColor(theme_manager.DARK_MODE_BUTTON_BG_MIDPOINT) + else: + color = theme_manager.qcolor(colors.FRAME_BG) + painter.setBrush(QBrush(color)) painter.drawEllipse(self._current_knob_rectangle()) def _paint_label(self, painter: QPainter) -> None: diff --git a/qt/aqt/theme.py b/qt/aqt/theme.py index 11b30d011..10970b53c 100644 --- a/qt/aqt/theme.py +++ b/qt/aqt/theme.py @@ -36,6 +36,10 @@ class ThemeManager: _icon_size = 128 _dark_mode_available: Optional[bool] = None + # Qt applies a gradient to the buttons in dark mode + # from about #505050 to #606060. + DARK_MODE_BUTTON_BG_MIDPOINT = "#555555" + def macos_dark_mode(self) -> bool: "True if the user has night mode on, and has forced native widgets." if not isMac: