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
Changes from 1 commit
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
Next Next commit
Fix iOS default background color
proneon267 committed Jan 13, 2025
commit d5224cc9c990439105c6dd903db34cf4c42eb241
8 changes: 7 additions & 1 deletion iOS/src/toga_iOS/widgets/base.py
Original file line number Diff line number Diff line change
@@ -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): ...

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