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
This commit is contained in:
llama 2024-12-14 18:30:28 +08:00 committed by GitHub
parent 36d0fddd38
commit 2d207ff5ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -201,6 +201,7 @@ Dongjin Ouyang <1113117424@qq.com>
Sawan Sunar <sawansunar24072002@gmail.com>
hideo aoyama <https://github.com/boukendesho>
Ross Brown <rbrownwsws@googlemail.com>
🦙 <github.com/iamllama>
********************

View file

@ -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