make switch more legible in dark mode
This commit is contained in:
parent
cba5c2253a
commit
54628c3ac7
@ -102,7 +102,11 @@ class Switch(QAbstractButton):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _paint_knob(self, painter: QPainter) -> None:
|
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())
|
painter.drawEllipse(self._current_knob_rectangle())
|
||||||
|
|
||||||
def _paint_label(self, painter: QPainter) -> None:
|
def _paint_label(self, painter: QPainter) -> None:
|
||||||
|
@ -36,6 +36,10 @@ class ThemeManager:
|
|||||||
_icon_size = 128
|
_icon_size = 128
|
||||||
_dark_mode_available: Optional[bool] = None
|
_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:
|
def macos_dark_mode(self) -> bool:
|
||||||
"True if the user has night mode on, and has forced native widgets."
|
"True if the user has night mode on, and has forced native widgets."
|
||||||
if not isMac:
|
if not isMac:
|
||||||
|
Loading…
Reference in New Issue
Block a user