Skip to content

Commit a00436d

Browse files
committed
Allow setting label colors with Tuples
Corrects issues with converting tuples of RGB values to ints, which Label objects require.
1 parent db3d9e5 commit a00436d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

adafruit_button/button.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ def __init__(
179179
self._selected_outline = _check_color(selected_outline)
180180

181181
if self.selected_fill is None and fill_color is not None:
182-
self.selected_fill = (~self._fill_color) & 0xFFFFFF
182+
self.selected_fill = (~_check_color(self._fill_color)) & 0xFFFFFF
183183
if self.selected_outline is None and outline_color is not None:
184-
self.selected_outline = (~self._outline_color) & 0xFFFFFF
184+
self.selected_outline = (~_check_color(self._outline_color)) & 0xFFFFFF
185185

186186
self._create_body()
187187
if self.body:

adafruit_button/button_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def label(self, newtext: str) -> None:
126126
self.append(self._label)
127127

128128
if (self.selected_label is None) and (self._label_color is not None):
129-
self.selected_label = (~self._label_color) & 0xFFFFFF
129+
self.selected_label = (~_check_color(self._label_color)) & 0xFFFFFF
130130

131131
def _subclass_selected_behavior(self, value: Optional[Any]) -> None:
132132
# Subclasses should override this!

0 commit comments

Comments
 (0)