/ examples / display_text_background_color.py
display_text_background_color.py
 1  """
 2  This examples shows the use color and background_color
 3  """
 4  import time
 5  import board
 6  import terminalio
 7  from adafruit_display_text import label
 8  
 9  text = " Color Background Hello world"
10  text_area = label.Label(
11      terminalio.FONT, text=text, color=0x0000FF, background_color=0xFFAA00
12  )
13  text_area.x = 10
14  text_area.y = 10
15  
16  print("background color is {:06x}".format(text_area.background_color))
17  
18  board.DISPLAY.show(text_area)
19  
20  time.sleep(2)
21  text_area.background_color = 0xFF0000
22  print("background color is {:06x}".format(text_area.background_color))
23  time.sleep(2)
24  text_area.background_color = None
25  print("background color is {}".format(text_area.background_color))
26  while True:
27      pass