Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

ansi

Usage

const ANSI = require('./ansi.js');
const ansi = new ANSI(process.stdout);

.moveTo(x, y)

Moves the cursor to the position specified by (x, y). These values are 1-based (The top left corner is (1, 1))

.up(y)

Moves the cursor up y units. Does not have any effect if the cursor is at the edge of the screen.

.down(y)

Moves the cursor down y units. Does not have any effect if the cursor is at the edge of the screen.

.forward(x)

Moves the cursor to the right x units. Does not have any effect if the cursor is at the edge of the screen.

.backward(x)

Moves the cursor to the left x units. Does not have any effect if the cursor is at the edge of the screen.

.save()

Saves the cursor position

.restore()

Restores the cursor position

.eraseLine()

Erases the contents of the current line the cursor is on

.eraseDisplay()

Erases the contents of the whole display

.color(color, bg)

Sets the color of the terminal at the position of the cursor. Holds its effect until the colors are reset. Either argument can be omitted to use only one or the other.

Colors
black
red
green
yellow
blue
magenta
cyan
white

.reset()

Resets the terminal colors to the default


.write(text)

Writes text directly to the given stream

About

Wrapper for ANSI escape code output

Resources

Releases

No releases published

Packages

No packages published