Skip to content

Commit 431b933

Browse files
committed
change set_text_color
1 parent 51d5747 commit 431b933

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

adafruit_matrixportal/matrixportal.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,10 @@ def set_text_color(self, color, index=0):
254254
:param index: Defaults to 0.
255255
256256
"""
257-
if self._text[index]:
258-
color = self.html_color_convert(color)
259-
self._text_color[index] = color
260-
self._text[index].color = color
257+
if 0 <= index < len(self._text_color):
258+
self._text_color[index] = self.html_color_convert(color)
259+
if self._text[index] is not None:
260+
self._text[index].color = self._text_color[index]
261261
else:
262262
raise IndexError(
263263
"index {} is out of bounds. Please call add_text() and set_text() first.".format(

0 commit comments

Comments
 (0)