Skip to content

Commit d699c32

Browse files
committed
c0l0rful text
1 parent 741e995 commit d699c32

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

adafruit_display_text/text_area.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747

4848
class TextArea:
49-
def __init__(self, font, *, text=None, width=None, height=1):
49+
def __init__(self, font, *, text=None, width=None, color=0x0, height=1):
5050
if not width and not text:
5151
raise RuntimeError("Please provide a width")
5252
if not width:
@@ -57,7 +57,7 @@ def __init__(self, font, *, text=None, width=None, height=1):
5757

5858
self.p = displayio.Palette(2)
5959
self.p.make_transparent(0)
60-
self.p[1] = 0xffffff
60+
self.p[1] = color
6161

6262
self.group = displayio.Group(max_size=width * height)
6363

@@ -91,6 +91,14 @@ def _update_text(self):
9191

9292
# TODO: support multiple lines by adjusting y
9393

94+
@property
95+
def color(self):
96+
return self.p[1]
97+
98+
@color.setter
99+
def color(self, c):
100+
self.p[1] = c
101+
94102
@property
95103
def text(self, t):
96104
self._text = t

0 commit comments

Comments
 (0)