Utility functions for ANSI escape code manipulation and terminal styling.
Support for Linux and Windows.
Simple API for initializing and handling key events.
πΉ π Quick Start β A quick guide to get you started with the library.
πΉ π API Reference β Detailed documentation of available functions.
If you have not already added the library to your project, please review the installation guide for more information.
const ansi = @import("io").terminal.ansi;
The
ansi
module provides powerful tools for styling the terminal. Letβs explore some of its features.
try ansi.colors.bg256(writer, .red);
try ansi.colors.fgRGB(writer, 255, 255, 255);
Function | Description |
---|---|
clear.all | Clears the entire terminal screen. |
clear.line | Clears the current line in the terminal. |
clear.screenFromCursor | Clears the screen from the cursor to the end. |
clear.screenToCursor | Clears the screen from the beginning to the cursor. |
clear.lineFromCursor | Clears the line from the cursor to the end. |
clear.lineToCursor | Clears the line from the beginning to the cursor. |
Function | Description |
---|---|
cursor.goTo | Moves the cursor to the specified position. |
cursor.goUp | Moves the cursor up by the specified number of rows. |
cursor.goDown | Moves the cursor down by the specified number of rows. |
cursor.goLeft | Moves the cursor left by the specified number of columns. |
cursor.goRight | Moves the cursor right by the specified number of columns. |
cursor.hide | Hides the cursor. |
cursor.show | Shows the cursor. |
cursor.save | Saves the current cursor position. |
cursor.restore | Restores the cursor to the saved position. |
Function | Description |
---|---|
colors.fg256 | Sets the foreground color using 256 colors. |
colors.bg256 | Sets the background color using 256 colors. |
colors.fgRGB | Sets the foreground color using RGB values. |
colors.bgRGB | Sets the background color using RGB values. |
colors.resetAll | Resets all colors and styles. |
Function | Description |
---|---|
attr.reset | Resets all attributes. |
attr.bold | Sets the bold attribute. |
attr.noBold | Unsets the bold attribute. |
attr.dim | Sets the dim attribute. |
attr.noDim | Unsets the dim attribute. |
attr.italic | Sets the italic attribute. |
attr.noItalic | Unsets the italic attribute. |
attr.underline | Sets the underline attribute. |
attr.noUnderline | Unsets the underline attribute. |
attr.blinking | Sets the blinking attribute. |
attr.noBlinking | Unsets the blinking attribute. |
attr.reverse | Sets the reverse attribute. |
attr.noReverse | Unsets the reverse attribute. |
attr.hidden | Sets the hidden attribute. |
attr.noHidden | Unsets the hidden attribute. |
attr.strikethrough | Sets the strikethrough attribute. |
attr.noStrikethrough | Unsets the strikethrough attribute. |
Detailed terminal information ensuring cross-platform compatibility.
Comprehensive terminal settings for cross-platform operation.
Seamless Command Line Integration with ZIG.
Robust event handling for terminal key presses and mouse events.
Interactive prompts for user input.