Skip to main content Link Search Menu Expand Document (external link)

Ansi overview

Added in v1.0.0


Table of contents


colors

bgBlack

Signature

export declare const bgBlack: Ansi

Added in v1.0.0

bgBlackBright

Signature

export declare const bgBlackBright: Ansi

Added in v1.0.0

bgBlue

Signature

export declare const bgBlue: Ansi

Added in v1.0.0

bgBlueBright

Signature

export declare const bgBlueBright: Ansi

Added in v1.0.0

bgCyan

Signature

export declare const bgCyan: Ansi

Added in v1.0.0

bgCyanBright

Signature

export declare const bgCyanBright: Ansi

Added in v1.0.0

bgGreen

Signature

export declare const bgGreen: Ansi

Added in v1.0.0

bgGreenBright

Signature

export declare const bgGreenBright: Ansi

Added in v1.0.0

bgMagenta

Signature

export declare const bgMagenta: Ansi

Added in v1.0.0

bgMagentaBright

Signature

export declare const bgMagentaBright: Ansi

Added in v1.0.0

bgRed

Signature

export declare const bgRed: Ansi

Added in v1.0.0

bgRedBright

Signature

export declare const bgRedBright: Ansi

Added in v1.0.0

bgWhite

Signature

export declare const bgWhite: Ansi

Added in v1.0.0

bgWhiteBright

Signature

export declare const bgWhiteBright: Ansi

Added in v1.0.0

bgYellow

Signature

export declare const bgYellow: Ansi

Added in v1.0.0

bgYellowBright

Signature

export declare const bgYellowBright: Ansi

Added in v1.0.0

black

Signature

export declare const black: Ansi

Added in v1.0.0

blackBright

Signature

export declare const blackBright: Ansi

Added in v1.0.0

blue

Signature

export declare const blue: Ansi

Added in v1.0.0

blueBright

Signature

export declare const blueBright: Ansi

Added in v1.0.0

cyan

Signature

export declare const cyan: Ansi

Added in v1.0.0

cyanBright

Signature

export declare const cyanBright: Ansi

Added in v1.0.0

green

Signature

export declare const green: Ansi

Added in v1.0.0

greenBright

Signature

export declare const greenBright: Ansi

Added in v1.0.0

magenta

Signature

export declare const magenta: Ansi

Added in v1.0.0

magentaBright

Signature

export declare const magentaBright: Ansi

Added in v1.0.0

red

Signature

export declare const red: Ansi

Added in v1.0.0

redBright

Signature

export declare const redBright: Ansi

Added in v1.0.0

white

Signature

export declare const white: Ansi

Added in v1.0.0

whiteBright

Signature

export declare const whiteBright: Ansi

Added in v1.0.0

yellow

Signature

export declare const yellow: Ansi

Added in v1.0.0

yellowBright

Signature

export declare const yellowBright: Ansi

Added in v1.0.0

commands

beep

Play a beeping sound.

Signature

export declare const beep: Ansi

Added in v1.0.0

cursorBackward

Moves the cursor backward by the specified number of columns (default 1) relative to the current cursor position.

If the cursor is already at the edge of the screen, this has no effect.

Signature

export declare const cursorBackward: (columns?: number) => Ansi

Added in v1.0.0

cursorDown

Moves the cursor down by the specified number of lines (default 1) relative to the current cursor position.

If the cursor is already at the edge of the screen, this has no effect.

Signature

export declare const cursorDown: (lines?: number) => Ansi

Added in v1.0.0

cursorForward

Moves the cursor forward by the specified number of columns (default 1) relative to the current cursor position.

If the cursor is already at the edge of the screen, this has no effect.

Signature

export declare const cursorForward: (columns?: number) => Ansi

Added in v1.0.0

cursorHide

Hides the cursor.

Signature

export declare const cursorHide: Ansi

Added in v1.0.0

cursorLeft

Moves the cursor to the first column of the current row.

Signature

export declare const cursorLeft: Ansi

Added in v1.0.0

cursorMove

Move the cursor position the specified number of rows and columns relative to the current cursor position.

If the cursor is already at the edge of the screen in either direction, then additional movement will have no effect.

Signature

export declare const cursorMove: (column: number, row?: number) => Ansi

Added in v1.0.0

cursorNextLine

Moves cursor to beginning of the line the specified number of rows down (default 1).

Signature

export declare const cursorNextLine: (rows?: number) => Ansi

Added in v1.0.0

cursorPrevLine

Moves cursor to beginning of the line the specified number of rows up (default 1).

Signature

export declare const cursorPrevLine: (rows?: number) => Ansi

Added in v1.0.0

cursorRestorePosition

Restores the cursor position, encoding shift state and formatting attributes from the previous save, if any, otherwise resets these all to their defaults.

Signature

export declare const cursorRestorePosition: Ansi

Added in v1.0.0

cursorSavePosition

Saves the cursor position, encoding shift state and formatting attributes.

Signature

export declare const cursorSavePosition: Ansi

Added in v1.0.0

cursorShow

Shows the cursor.

Signature

export declare const cursorShow: Ansi

Added in v1.0.0

cursorTo

Moves the cursor to the specified row and column.

Though the ANSI Control Sequence for Cursor Position is 1-based, this method takes row and column values starting from 0 and adjusts them to 1- based values.

Signature

export declare const cursorTo: (column: number, row?: number) => Ansi

Added in v1.0.0

cursorUp

Moves the cursor up by the specified number of lines (default 1) relative to the current cursor position.

If the cursor is already at the edge of the screen, this has no effect.

Signature

export declare const cursorUp: (lines?: number) => Ansi

Added in v1.0.0

eraseDown

Clears from the current cursor position to the end of the screen.

The current cursor position does not change.

Signature

export declare const eraseDown: Ansi

Added in v1.0.0

eraseEndLine

Clears from the current cursor position to the end of the current line.

The current cursor position does not change.

Signature

export declare const eraseEndLine: Ansi

Added in v1.0.0

eraseLine

Clears the current line.

The current cursor position does not change.

Signature

export declare const eraseLine: Ansi

Added in v1.0.0

eraseLines

Erase from the current cursor position up the specified amount of rows.

Signature

export declare const eraseLines: (rows: number) => Ansi

Added in v1.0.0

eraseScreen

Clears the entire screen and move the cursor to the upper left.

Signature

export declare const eraseScreen: Ansi

Added in v1.0.0

eraseStartLine

Clears from the current cursor position to the start of the current line.

The current cursor position does not change.

Signature

export declare const eraseStartLine: Ansi

Added in v1.0.0

eraseUp

Clears from the current cursor position to the beginning of the screen.

The current cursor position does not change.

Signature

export declare const eraseUp: Ansi

Added in v1.0.0

constructors

bgColor

Signature

export declare const bgColor: (color: Color) => Ansi

Added in v1.0.0

bgColorBright

Signature

export declare const bgColorBright: (color: Color) => Ansi

Added in v1.0.0

bold

Signature

export declare const bold: Ansi

Added in v1.0.0

brightColor

Signature

export declare const brightColor: (color: Color) => Ansi

Added in v1.0.0

color

Signature

export declare const color: (color: Color) => Ansi

Added in v1.0.0

italicized

Signature

export declare const italicized: Ansi

Added in v1.0.0

strikethrough

Signature

export declare const strikethrough: Ansi

Added in v1.0.0

underlined

Signature

export declare const underlined: Ansi

Added in v1.0.0

destructors

stringify

Signature

export declare const stringify: (self: Ansi) => string

Added in v1.0.0

model

Ansi (interface)

Signature

export interface Ansi extends Ansi.Proto {}

Added in v1.0.0

symbol

AnsiTypeId

Signature

export declare const AnsiTypeId: typeof AnsiTypeId

Added in v1.0.0

AnsiTypeId (type alias)

Signature

export type AnsiTypeId = typeof AnsiTypeId

Added in v1.0.0

utils

Ansi (namespace)

Added in v1.0.0

Proto (interface)

Signature

export interface Proto {
  readonly [AnsiTypeId]: AnsiTypeId
}

Added in v1.0.0

combine

Signature

export declare const combine: { (that: Ansi): (self: Ansi) => Ansi; (self: Ansi, that: Ansi): Ansi }

Added in v1.0.0