Simple test

Ensure your device works with this simple test.

examples/color_terminal_simpletest.py
 1# SPDX-FileCopyrightText: Copyright (c) 2025 Tim Cocks for Adafruit Industries
 2#
 3# SPDX-License-Identifier: MIT
 4
 5import supervisor
 6from displayio import Group
 7from terminalio import FONT
 8
 9from adafruit_color_terminal import ColorTerminal
10
11main_group = Group()
12display = supervisor.runtime.display
13font_bb = FONT.get_bounding_box()
14screen_size = (display.width // font_bb[0], display.height // font_bb[1])
15
16terminal = ColorTerminal(FONT, screen_size[0], screen_size[1])
17main_group.append(terminal.tilegrid)
18
19black = chr(27) + "[30m"
20red = chr(27) + "[31m"
21green = chr(27) + "[32m"
22yellow = chr(27) + "[33m"
23blue = chr(27) + "[34m"
24magenta = chr(27) + "[35m"
25cyan = chr(27) + "[36m"
26white = chr(27) + "[37m"
27reset = chr(27) + "[0m"
28
29
30message = f"Hello {green}World{reset} {yellow}ANSI\n"
31terminal.write(message)
32print(message, end="")
33
34message = f"{magenta}Terminal {red}Colors{reset}"
35terminal.write(message)
36print(message)
37
38display.root_group = main_group
39
40print(terminal.cursor_x, terminal.cursor_y)
41
42move_cursor = chr(27) + "[10;10H"
43terminal.write(f" Something {move_cursor}{cyan} Else{reset}")
44print(f" Something {move_cursor}{cyan} Else{reset}")
45
46while True:
47    pass