From d5224cc9c990439105c6dd903db34cf4c42eb241 Mon Sep 17 00:00:00 2001 From: proneon267 Date: Mon, 13 Jan 2025 09:33:57 -0800 Subject: [PATCH 1/2] Fix iOS default background color --- iOS/src/toga_iOS/widgets/base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/iOS/src/toga_iOS/widgets/base.py b/iOS/src/toga_iOS/widgets/base.py index b0ff57ab39..8284a25d35 100644 --- a/iOS/src/toga_iOS/widgets/base.py +++ b/iOS/src/toga_iOS/widgets/base.py @@ -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): From 48a0768db6f5d47a722779baa3ed7c8ab1480fb4 Mon Sep 17 00:00:00 2001 From: proneon267 Date: Mon, 13 Jan 2025 10:15:57 -0800 Subject: [PATCH 2/2] Add changelog --- changes/3104.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/3104.misc.rst diff --git a/changes/3104.misc.rst b/changes/3104.misc.rst new file mode 100644 index 0000000000..e7e09e3d62 --- /dev/null +++ b/changes/3104.misc.rst @@ -0,0 +1 @@ +The default background color of `toga.Label` on iOS now correctly displays a transparent background, instead of a black background.