Skip to content

Commit 0fe25b5

Browse files
committed
fix constructor for visible black background color
1 parent 870643a commit 0fe25b5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

adafruit_display_text/label.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ def __init__(self, font, *, x=0, y=0, text=None, max_glyphs=None, color=0xffffff
7171
self.y = y
7272

7373
self.palette = displayio.Palette(2)
74-
if not background_color:
75-
self._transparent_background = True
76-
self.palette.make_transparent(0)
77-
else:
74+
if background_color or background_color == 0x000000:
75+
self.palette[0] = new_color
76+
self.palette.make_opaque(0)
7877
self._transparent_background = False
79-
self.palette[0] = background_color
78+
else:
79+
self.palette[0] = 0
80+
self.palette.make_transparent(0)
81+
self._transparent_background = True
8082
self.palette[1] = color
8183

8284
bounds = self.font.get_bounding_box()

0 commit comments

Comments
 (0)