@@ -86,8 +86,6 @@ def __init__(self, title="CLUE Sensor Data", title_color=0xFFFFFF, title_scale=1
86
86
87
87
if not colors :
88
88
colors = ((255 , 0 , 255 ), (0 , 255 , 0 ), (255 , 0 , 0 ), (0 , 255 , 255 ), (255 , 255 , 0 ),
89
- (0 , 0 , 255 ), (255 , 0 , 180 ), (0 , 180 , 255 ), (255 , 180 , 0 ), (180 , 0 , 255 ),
90
- (255 , 0 , 255 ), (0 , 255 , 0 ), (255 , 0 , 0 ), (0 , 255 , 255 ), (255 , 255 , 0 ),
91
89
(0 , 0 , 255 ), (255 , 0 , 180 ), (0 , 180 , 255 ), (255 , 180 , 0 ), (180 , 0 , 255 ))
92
90
93
91
self ._label = label
@@ -111,7 +109,7 @@ def __init__(self, title="CLUE Sensor Data", title_color=0xFFFFFF, title_scale=1
111
109
112
110
self ._lines = []
113
111
for num in range (num_lines ):
114
- self ._lines .append (self .add_text_line (color = colors [num ]))
112
+ self ._lines .append (self .add_text_line (color = colors [num % len ( colors ) ]))
115
113
116
114
def __getitem__ (self , item ):
117
115
"""Fetch the Nth text line Group"""
@@ -814,11 +812,13 @@ def display_clue_data(title="CLUE Sensor Data", title_color=(255, 255, 255), tit
814
812
Defaults to 1.
815
813
:param str font: The font to use to display the title and data. Defaults to built in
816
814
``terminalio.FONT``.
817
- :param colors: A list of colors for the lines of data on the display that must include one
818
- color for each of the lines you intend to display. Default colors are
819
- used if ``colors`` is not set. For example, if creating two lines of data,
820
- ``colors=((255, 255, 255), (255, 0, 0))`` would set the first line white
821
- and the second line red.
815
+ :param colors: A list of colors for the lines of data on the display. If you provide a
816
+ single color, all lines will be that color. Otherwise it will alternate the
817
+ list you provide if the list is less than the number of lines displayed.
818
+ Default colors are used if ``colors`` is not set. For example, if creating
819
+ two lines of data, ``colors=((255, 255, 255), (255, 0, 0))`` would set the
820
+ first line white and the second line red, and if you created four lines of
821
+ data with the same setup, it would alternate white and red.
822
822
823
823
.. image :: ../docs/_static/display_clue_data.jpg
824
824
:alt: Display Clue Data demo
0 commit comments