Skip to main content

Introduction

Documentation Status Discord Build Status Code Style: Ruff

Extension of supports ANSI color escapes for subsets of text

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-color-terminal

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-color-terminal

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .env/bin/activate
pip3 install adafruit-circuitpython-color-terminal

Installing to a Connected CircuitPython Device with Circup

Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:

pip3 install circup

With circup installed and your CircuitPython device connected use the following command to install:

circup install adafruit_color_terminal

Or the following command to update an existing version:

circup update

Usage Example

import supervisor
from displayio import Group
from terminalio import FONT

from adafruit_color_terminal import ColorTerminal

main_group = Group()
display = supervisor.runtime.display
font_bb = FONT.get_bounding_box()
screen_size = (display.width // font_bb[0], display.height // font_bb[1])

terminal = ColorTerminal(FONT, screen_size[0], screen_size[1])
main_group.append(terminal.tilegrid)

black = chr(27) + "[30m"
red = chr(27) + "[31m"
green = chr(27) + "[32m"
yellow = chr(27) + "[33m"
blue = chr(27) + "[34m"
magenta = chr(27) + "[35m"
cyan = chr(27) + "[36m"
white = chr(27) + "[37m"
reset = chr(27) + "[0m"


message = f"Hello {green}World{reset} {yellow}ANSI\n"
terminal.write(message)
print(message, end="")

message = f"{magenta}Terminal {red}Colors{reset}"
terminal.write(message)
print(message)

display.root_group = main_group

print(terminal.cursor_x, terminal.cursor_y)

move_cursor = chr(27) + "[10;10H"
terminal.write(f" Something {move_cursor}{cyan} Else{reset}")
print(f" Something {move_cursor}{cyan} Else{reset}")

while True:
    pass

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Metadata

Release files for adafruit-circuitpython-color-terminal 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adafruit-circuitpython-color-terminal 0.2.3
File Size Uploaded
adafruit_circuitpython_color_terminal-0.2.3.tar.gz 33.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for adafruit-circuitpython-color-terminal 0.2.3
File Interpreter ABI Platform
adafruit_circuitpython_color_terminal-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 40.6 kB

Release files / adafruit_circuitpython_color_terminal-0.2.3.tar.gz

Download URL adafruit_circuitpython_color_terminal-0.2.3.tar.gz
Size 33.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8ed3f648eda2289692635b4b613baaa2a6f749d716193eae81ca5801a2dcf71d
BLAKE2b-256 checksum
How to use checksums
f2c2c0ff9ed8a90dbf58671954ac2abd8ab779163fa6b6d0721bb8b090d71598
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / adafruit_circuitpython_color_terminal-0.2.3-py3-none-any.whl

Download URL adafruit_circuitpython_color_terminal-0.2.3-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fbeee2403ba92267caf31d3f1c2a16c507d3fd0baa64fe53ee3eac4e6406d8d2
BLAKE2b-256 checksum
How to use checksums
3d15c68f0cd63b0ce35d40b3934b81cc856f3e4e7c5e3ed787bddc031d773cb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page