Pure Elixir terminal I/O using OTP 28+ raw mode and IO.ANSI.
Cross-platform terminal support without NIFs. Works on:
- Windows 10+ (with VT100 support)
- macOS
- Linux
Uses:
- OTP 28's
shell:start_interactive/1for raw terminal mode IO.ANSIfor escape sequences and colors:io.setopts/1for terminal configuration
Summary
Functions
Clear the entire screen.
Get terminal width and height.
Returns {:ok, {width, height}} or {:error, reason}.
Hide the cursor.
Initialize the terminal in raw mode.
Returns {:ok, state} or {:error, reason}.
Present (flush) all pending output to the terminal.
Print a string at position (x, y) with colors.
Read a single character/keypress in raw mode.
Returns {:ok, char} or {:error, reason}.
Set a cell at position (x, y) with character, foreground, and background. Colors are 8-bit ANSI color codes (0-255).
Set cursor position (0-indexed).
Set terminal title.
Show the cursor.
Shutdown terminal and restore settings.
Functions
Clear the entire screen.
Get terminal width and height.
Returns {:ok, {width, height}} or {:error, reason}.
Hide the cursor.
Initialize the terminal in raw mode.
Returns {:ok, state} or {:error, reason}.
Present (flush) all pending output to the terminal.
Print a string at position (x, y) with colors.
Read a single character/keypress in raw mode.
Returns {:ok, char} or {:error, reason}.
Set a cell at position (x, y) with character, foreground, and background. Colors are 8-bit ANSI color codes (0-255).
Set cursor position (0-indexed).
Set terminal title.
Show the cursor.
Shutdown terminal and restore settings.