User Manual

Next we create a background splash image. We do this by creating a group that we can add elements to and adding
that group to the display. In this example, we are limiting the maximum number of elements to 10, but this can be
increased if you would like. The display will automatically handle updating the group.
Next we create a Bitmap which is like a canvas that we can draw on. In this case we are creating the Bitmap to be the
same size as the screen, but only have one color. The Bitmaps can currently handle up to 256 different colors. We
create a Palette with one color and set that color to 0x00FF00 which happens to be green. Colors are Hexadecimal
values in the format of RRGGBB. Even though the Bitmaps can only handle 256 colors at a time, you get to define what
those 256 different colors are.
With all those pieces in place, we create a TileGrid by passing the bitmap and palette and draw it at (0, 0) which
represents the display's upper left.
splash = displayio.Group(max_size=10)
display.show(splash)
color_bitmap = displayio.Bitmap(320, 240, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0x00FF00 # Bright Green
bg_sprite = displayio.TileGrid(color_bitmap,
pixel_shader=color_palette,
x=0, y=0)
splash.append(bg_sprite)
© Adafruit Industries https://learn.adafruit.com/2-0-inch-320-x-240-color-ips-tft-display Page 22 of 27