From 2d207ff5ba399bd161c0fb1145349a9bd54d69e2 Mon Sep 17 00:00:00 2001 From: llama <100429699+iamllama@users.noreply.github.com> Date: Sat, 14 Dec 2024 18:30:28 +0800 Subject: [PATCH] Remove hardcoded note/card colours from switch.py (#3629) * Remove hardcoded note/card colours in switch.py * Modify CONTRIBUTORS * Switch to None as a safe default value --- CONTRIBUTORS | 1 + qt/aqt/switch.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index e6e1da9a2..6a83c444d 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -201,6 +201,7 @@ Dongjin Ouyang <1113117424@qq.com> Sawan Sunar hideo aoyama Ross Brown +🦙 ******************** diff --git a/qt/aqt/switch.py b/qt/aqt/switch.py index 214d20bc7..cbea035a0 100644 --- a/qt/aqt/switch.py +++ b/qt/aqt/switch.py @@ -21,8 +21,8 @@ class Switch(QAbstractButton): radius: int = 10, left_label: str = "", right_label: str = "", - left_color: dict[str, str] = colors.ACCENT_CARD | {}, - right_color: dict[str, str] = colors.ACCENT_NOTE | {}, + left_color: dict[str, str] | None = None, + right_color: dict[str, str] | None = None, parent: QWidget | None = None, ) -> None: super().__init__(parent=parent) @@ -31,8 +31,8 @@ class Switch(QAbstractButton): self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed) self._left_label = left_label self._right_label = right_label - self._left_color = left_color - self._right_color = right_color + self._left_color = left_color if left_color else colors.ACCENT_CARD + self._right_color = right_color if right_color else colors.ACCENT_NOTE self._path_radius = radius self._knob_radius = radius - 2 self._label_padding = 4