ANSITerm is an Arduino library that sends ANSI/VT-style escape sequences to a terminal via any Stream (e.g., Serial), letting you clear the screen, position the cursor, colorize text, draw boxes/tables, and (where supported) handle mouse clicks.
Note: This library is under active development. Please report issues with a minimal sketch and your terminal + board details.
- Screen & cursor control:
clearScreen(),setCursorPosition(),resetFormatting() - Colors: 8-bit, hex, RGB, and common names via
setTextColor*()/setBackgroundColor*() - Drawing: single/double line boxes, tables, text at coordinates, delete at position
- UI helpers: single/double “buttons”, click detection (requires terminal mouse reporting)
- Mouse: enable/disable reporting, parse terminal mouse packets
See the examples/ folder for usage patterns.
Search ANSITerm in Arduino IDE → Tools → Manage Libraries… and click Install.
- Download this repository (Code → Download ZIP).
- Extract to your Arduino libraries folder (e.g.,
~/Arduino/libraries/ANSITerm). - Restart the IDE.
The CI compiles every sketch in examples/ for:
arduino:avr:unoarduino:avr:leonardoarduino:avr:mega
You can extend the matrix in .github/workflows/arduino-ci.yml to other cores (ESP32, etc.) once supported.
#include <ANSITerm.h>
ANSITerm terminal(Serial);
void setup() {
Serial.begin(9600);
while (!Serial) { ; }
terminal.begin();
terminal.clearScreen();
terminal.setTextColorByName("yellow");
terminal.writeTextAt(2, 10, "Welcome to ANSITerm!");
}
void loop() {}- File bugs and feature requests in Issues.
- Pull requests welcome. Please keep patches focused and ensure CI is green.
- Update
library.propertiesversion=(e.g.,0.1.0). - Tag and push:
git tag -a v0.1.0 -m "ANSITerm 0.1.0" && git push --follow-tags. - Create a GitHub Release from the tag.
- Submit your repository URL to the Arduino Library Manager registry (add to
repositories.txt). Subsequent semver tags are indexed automatically once accepted.
LGPL-3.0 — see LICENSE.txt.