Skip to content

Commit

Permalink
Allow setting label colors with Tuples
Browse files Browse the repository at this point in the history
Corrects issues with converting tuples of RGB values to ints, which Label objects require.
  • Loading branch information
ch4nsuk3 committed Dec 1, 2024
1 parent db3d9e5 commit a00436d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions adafruit_button/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ def __init__(
self._selected_outline = _check_color(selected_outline)

if self.selected_fill is None and fill_color is not None:
self.selected_fill = (~self._fill_color) & 0xFFFFFF
self.selected_fill = (~_check_color(self._fill_color)) & 0xFFFFFF
if self.selected_outline is None and outline_color is not None:
self.selected_outline = (~self._outline_color) & 0xFFFFFF
self.selected_outline = (~_check_color(self._outline_color)) & 0xFFFFFF

self._create_body()
if self.body:
Expand Down
2 changes: 1 addition & 1 deletion adafruit_button/button_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def label(self, newtext: str) -> None:
self.append(self._label)

if (self.selected_label is None) and (self._label_color is not None):
self.selected_label = (~self._label_color) & 0xFFFFFF
self.selected_label = (~_check_color(self._label_color)) & 0xFFFFFF

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

0 comments on commit a00436d

Please sign in to comment.