This library provides functionality for interacting with the terminal, manipulating terminal modes, screen buffers, cursor behavior, generating colors and more. term
among many things, can assist in building a TUI without a dependency to curses, abstract the difficulty of working with the terminal and ANSI escape sequences
The convienently (clearly not creatively) named term
library mainly utilizies the termios library, raw ANSI escape sequences and other standard Nim libraries
Install term
from nimble
nimble install https://github.com/wick3dr0se/term
Import term
import term
Set the terminal to raw, canonical, noecho or cooked (default) mode
setMode(noecho) # disable echoing to the terminal
setMode(cooked) # *reset* the terminal
Scroll the terminal screen
scrollUp(10) # scroll up 10 lines
scrollDown() # scroll down 1 (implicit) line
Switch to the alternative screen buffer
altBuffer()
mainBuffer() # switch back to the main buffer
Output a random colored string
echoRandColor("test") # will print in true color if possible