Skip to content

Commit

Permalink
Remove complex background color assignment on button
Browse files Browse the repository at this point in the history
  • Loading branch information
proneon267 committed Dec 4, 2024
1 parent 5813bc0 commit a68c366
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
17 changes: 7 additions & 10 deletions iOS/src/toga_iOS/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,13 @@ def set_color(self, color):
# By default, color can't be changed
pass

def set_background_color(self, color, is_native_color=False):
if is_native_color:
self.native.backgroundColor = color
else:
default_background_color = getattr(
self, "_default_background_color", UIColor.systemBackgroundColor()
)
self.native.backgroundColor = (
default_background_color if color is None else native_color(color)
)
def set_background_color(self, color):
default_background_color = getattr(
self, "_default_background_color", UIColor.systemBackgroundColor()
)
self.native.backgroundColor = (
default_background_color if color is None else native_color(color)
)

# INTERFACE
def add_child(self, child):
Expand Down
5 changes: 1 addition & 4 deletions iOS/src/toga_iOS/widgets/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ def set_color(self, color):
)

def set_background_color(self, color):
super().set_background_color(
(None if color in {None, TRANSPARENT} else native_color(color)),
is_native_color=True,
)
super().set_background_color(None if color in {None, TRANSPARENT} else color)

def set_font(self, font):
self.native.titleLabel.font = font._impl.native
Expand Down

0 comments on commit a68c366

Please sign in to comment.