Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3009 (iOS default widget background color) #3104

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/3104.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The default background color of `toga.Label` on iOS now correctly displays a transparent background, instead of a black background.
8 changes: 7 additions & 1 deletion iOS/src/toga_iOS/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ def __init__(self, interface):
self.native = None
self.create()

# Override this attribute to set a different default background
# color for a given widget.
self._default_background_color = self.native.backgroundColor

@abstractmethod
def create(self): ...

Expand Down Expand Up @@ -87,7 +91,9 @@ def set_color(self, color):
pass

def set_background_color(self, color):
self.native.backgroundColor = None if color is None else native_color(color)
self.native.backgroundColor = (
self._default_background_color if color is None else native_color(color)
)

# INTERFACE
def add_child(self, child):
Expand Down
Loading