ANSI-Project 1.0
Make quick ANSI formats to beautify terminal output
Static Public Member Functions | Static Public Attributes | List of all members
ansi.ANSI Class Reference

Static Public Member Functions

static string SGR (string str)
 
static string RGB (int r, int g, int b)
 
static string BK_RGB (int r, int g, int b)
 
static string CUU (int n)
 
static string CUD (int n)
 
static string CUF (int n)
 
static string CUB (int n)
 
static string CNL (int n)
 
static string CPL (int n)
 
static string CHA (int n)
 
static string CUP (int row, int col)
 
static string ED (int n)
 
static string EL (int n)
 
static string SU (int n)
 
static string SD (int n)
 
static string HVP (int row, int col)
 
static string custom (string str)
 

Static Public Attributes

static string ESC = "\u001B"
 
static string CSI = "\u009B"
 
static string DSC = "\u0090"
 
static string OSC = "\u009D"
 
static string RESET = ESC+"[0m"
 
static string BOLD = ESC+"[1m"
 
static string FAINT = ESC+"[2m"
 
static string ITALIC = ESC+"[3m"
 
static string UNDER = ESC+"[4m"
 
static string SBLINK = ESC+"[5m"
 
static string RBLINK = ESC+"[6m"
 
static string REVERSE = ESC+"[7m"
 
static string HIDE = ESC+"[8m"
 
static string STRIKE = ESC+"[9m"
 
static string DEF_FONT = ESC+"[10m"
 
static string Franktur = ESC+"[20m"
 
static string BOLD_OFF = ESC+"[21m"
 
static string HI_OFF = ESC+"[22m"
 
static string ITALIC_OFF = ESC+"[23m"
 
static string UNDER_OFF = ESC+"[24m"
 
static string BLINK_OFF = ESC+"[25m"
 
static string REVERSE_OFF = ESC+"[27m"
 
static string REVEAL = ESC+"[28m"
 
static string STRIKE_OFF = ESC+"[29m"
 
static string BLACK = ESC+"[30m"
 
static string RED = ESC+"[31m"
 
static string GREEN = ESC+"[32m"
 
static string YELLOW = ESC+"[33m"
 
static string BLUE = ESC+"[34m"
 
static string PURPLE = ESC+"[35m"
 
static string CYAN = ESC+"[36m"
 
static string WHITE = ESC+"[37m"
 
static string DEFAULT = ESC+"[39m"
 
static string BK_BLACK = ESC+"[40m"
 
static string BK_RED = ESC+"[41m"
 
static string BK_GREEN = ESC+"[42m"
 
static string BK_YELLOW = ESC+"[43m"
 
static string BK_BLUE = ESC+"[44m"
 
static string BK_PURPLE = ESC+"[45m"
 
static string BK_CYAN = ESC+"[46m"
 
static string BK_WHITE = ESC+"[47m"
 
static string BK_DEFAULT = ESC+"[49m"
 
static string BLACK_HI = ESC+"[90m"
 
static string RED_HI = ESC+"[91m"
 
static string GREEN_HI = ESC+"[92m"
 
static string YELLOW_HI = ESC+"[93m"
 
static string BLUE_HI = ESC+"[94m"
 
static string PURPLE_HI = ESC+"[95m"
 
static string CYAN_HI = ESC+"[96m"
 
static string WHITE_HI = ESC+"[97m"
 
static string BK_BLACK_HI = ESC+"[100m"
 
static string BK_RED_HI = ESC+"[101m"
 
static string BK_GREEN_HI = ESC+"[102m"
 
static string BK_YELLOW_HI = ESC+"[103m"
 
static string BK_BLUE_HI = ESC+"[104m"
 
static string BK_PURPLE_HI = ESC+"[105m"
 
static string BK_CYAN_HI = ESC+"[106m"
 
static string BK_WHITE_HI = ESC+"[107m"
 
static string C0 = ESC+"[1;1H"
 
static string CUU1 = ESC+"[1A"
 
static string CUD1 = ESC+"[1B"
 
static string CUF1 = ESC+"[1C"
 
static string CUB1 = ESC+"[1D"
 
static string CNL1 = ESC+"[1E"
 
static string CPL1 = ESC+"[1F"
 
static string SU1 = ESC+"[1S"
 
static string SD1 = ESC+"[1T"
 
static string ED0 = ESC+"[0J"
 
static string ED1 = ESC+"[1J"
 
static string ED2 = ESC+"[2J"
 
static string ED3 = ESC+"[3J"
 
static string EL0 = ESC+"[0K"
 
static string EL1 = ESC+"[1K"
 
static string EL2 = ESC+"[2K"
 
static string AUX_PORT_ON = ESC+"[5i"
 
static string AUX_PORT_OFF = ESC+"[4i"
 
static string DSR = ESC+"[6n"
 
static string SCP = ESC+"[s"
 
static string RCP = ESC+"[u"
 

Member Function Documentation

◆ BK_RGB()

static string ansi.ANSI.BK_RGB ( int  r,
int  g,
int  b 
)
static

Specify the Background color in RGB

Parameters
rRed value
gGreen value
bBlue value
Returns
string to be printed

◆ CHA()

static string ansi.ANSI.CHA ( int  n)
static

Moves the cursor to column n (default 1)

Parameters
n
Returns
string to be printed

◆ CNL()

static string ansi.ANSI.CNL ( int  n)
static

Moves cursor to beginning of the line n (default 1) lines down.

Parameters
n
Returns
string to be printed

◆ CPL()

static string ansi.ANSI.CPL ( int  n)
static

Moves cursor to beginning of the line n (default 1) lines up.

Parameters
n
Returns
string to be printed

◆ CUB()

static string ansi.ANSI.CUB ( int  n)
static

Moves the cursor n (default 1) cells backwards

Parameters
n
Returns
string to be printed

◆ CUD()

static string ansi.ANSI.CUD ( int  n)
static

Moves the cursor n (default 1) cells down

Parameters
n
Returns
string to be printed

◆ CUF()

static string ansi.ANSI.CUF ( int  n)
static

Moves the cursor n (default 1) cells forwards

Parameters
n
Returns
string to be printed

◆ CUP()

static string ansi.ANSI.CUP ( int  row,
int  col 
)
static

Moves the cursor to [row, column]. The values are 1-based.

Parameters
row
col
Returns
string to be printed

◆ custom()

static string ansi.ANSI.custom ( string  str)
static

Returns a custom ANSI ESCAPE SEQUENCE

Parameters
str
Returns
ESC + "[" + str

◆ CUU()

static string ansi.ANSI.CUU ( int  n)
static

Moves the cursor n (default 1) cells up

Parameters
n
Returns
string to be printed

◆ ED()

static string ansi.ANSI.ED ( int  n)
static

Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen (and moves cursor to upper left on DOS ANSI.SYS). If n is 3, clear entire screen and delete all lines saved in the scrollback buffer (this feature was added for xterm and is supported by other terminal applications).

Parameters
n
Returns
string to be printed

◆ EL()

static string ansi.ANSI.EL ( int  n)
static

Erases part of the line If n is 0 (or missing), clear from cursor to the end of the line If n is 1, clear from cursor to beginning of the line If n is 2, clear entire line. Cursor position does not change.

Parameters
n
Returns
string to be printed

◆ HVP()

static string ansi.ANSI.HVP ( int  row,
int  col 
)
static

Same as CUP, but counts as a format effector function (like CR or LF) rather than an editor function (like CUD or CNL) This can lead to different handling in certain terminal modes

Parameters
row
col
Returns
string to be printed

◆ RGB()

static string ansi.ANSI.RGB ( int  r,
int  g,
int  b 
)
static

Specify the Foreground color in RGB

Parameters
rRed value
gGreen value
bBlue value
Returns
string to be printed

◆ SD()

static string ansi.ANSI.SD ( int  n)
static

Scroll whole page down by n (default 1) lines. New lines are added at the top. (not ANSI.SYS)

Parameters
n
Returns
string to be printed

◆ SGR()

static string ansi.ANSI.SGR ( string  str)
static

Sets colors and style of the characters following this code Example: ANSI.SGR("40;91") makes RED_HI over BK_BLACK

Parameters
str
Returns
string to be printed

◆ SU()

static string ansi.ANSI.SU ( int  n)
static

Scroll whole page up by n (default 1) lines. New lines are added at the bottom. (not ANSI.SYS)

Parameters
n
Returns
string to be printed

Member Data Documentation

◆ AUX_PORT_OFF

string ansi.ANSI.AUX_PORT_OFF = ESC+"[4i"
static

Enable aux serial port usually for local serial printer

Returns
ESC [4i

◆ AUX_PORT_ON

string ansi.ANSI.AUX_PORT_ON = ESC+"[5i"
static

Enable aux serial port usually for local serial printer

Returns
ESC [5i

◆ BK_BLACK

string ansi.ANSI.BK_BLACK = ESC+"[40m"
static

◆ BK_BLACK_HI

string ansi.ANSI.BK_BLACK_HI = ESC+"[100m"
static

◆ BK_BLUE

string ansi.ANSI.BK_BLUE = ESC+"[44m"
static

◆ BK_BLUE_HI

string ansi.ANSI.BK_BLUE_HI = ESC+"[104m"
static

◆ BK_CYAN

string ansi.ANSI.BK_CYAN = ESC+"[46m"
static

◆ BK_CYAN_HI

string ansi.ANSI.BK_CYAN_HI = ESC+"[106m"
static

◆ BK_DEFAULT

string ansi.ANSI.BK_DEFAULT = ESC+"[49m"
static

◆ BK_GREEN

string ansi.ANSI.BK_GREEN = ESC+"[42m"
static

◆ BK_GREEN_HI

string ansi.ANSI.BK_GREEN_HI = ESC+"[102m"
static

◆ BK_PURPLE

string ansi.ANSI.BK_PURPLE = ESC+"[45m"
static

◆ BK_PURPLE_HI

string ansi.ANSI.BK_PURPLE_HI = ESC+"[105m"
static

◆ BK_RED

string ansi.ANSI.BK_RED = ESC+"[41m"
static

◆ BK_RED_HI

string ansi.ANSI.BK_RED_HI = ESC+"[101m"
static

◆ BK_WHITE

string ansi.ANSI.BK_WHITE = ESC+"[47m"
static

◆ BK_WHITE_HI

string ansi.ANSI.BK_WHITE_HI = ESC+"[107m"
static

◆ BK_YELLOW

string ansi.ANSI.BK_YELLOW = ESC+"[43m"
static

◆ BK_YELLOW_HI

string ansi.ANSI.BK_YELLOW_HI = ESC+"[103m"
static

◆ BLACK

string ansi.ANSI.BLACK = ESC+"[30m"
static

◆ BLACK_HI

string ansi.ANSI.BLACK_HI = ESC+"[90m"
static

◆ BLINK_OFF

string ansi.ANSI.BLINK_OFF = ESC+"[25m"
static

◆ BLUE

string ansi.ANSI.BLUE = ESC+"[34m"
static

◆ BLUE_HI

string ansi.ANSI.BLUE_HI = ESC+"[94m"
static

◆ BOLD

string ansi.ANSI.BOLD = ESC+"[1m"
static

◆ BOLD_OFF

string ansi.ANSI.BOLD_OFF = ESC+"[21m"
static

◆ C0

string ansi.ANSI.C0 = ESC+"[1;1H"
static

Place the cursor in top-left corner Same as CUP(1,1)

Returns
ESC [1;1H

◆ CNL1

string ansi.ANSI.CNL1 = ESC+"[1E"
static

Moves cursor to beginning of the next line

Returns
ESC [1E

◆ CPL1

string ansi.ANSI.CPL1 = ESC+"[1F"
static

Moves cursor to beginning of the previous line

Returns
ESC [1F

◆ CSI

string ansi.ANSI.CSI = "\u009B"
static

◆ CUB1

string ansi.ANSI.CUB1 = ESC+"[1D"
static

Move the cursor 1 cell backwards

Returns
ESC [1D

◆ CUD1

string ansi.ANSI.CUD1 = ESC+"[1B"
static

Move the cursor 1 row down

Returns
ESC [1B

◆ CUF1

string ansi.ANSI.CUF1 = ESC+"[1C"
static

Move the cursor 1 cell forwards

Returns
ESC [1C

◆ CUU1

string ansi.ANSI.CUU1 = ESC+"[1A"
static

Move the cursor 1 row up

Returns
ESC [1A

◆ CYAN

string ansi.ANSI.CYAN = ESC+"[36m"
static

◆ CYAN_HI

string ansi.ANSI.CYAN_HI = ESC+"[96m"
static

◆ DEF_FONT

string ansi.ANSI.DEF_FONT = ESC+"[10m"
static

Default font

◆ DEFAULT

string ansi.ANSI.DEFAULT = ESC+"[39m"
static

◆ DSC

string ansi.ANSI.DSC = "\u0090"
static

◆ DSR

string ansi.ANSI.DSR = ESC+"[6n"
static

Reports the cursor position (CPR) by transmitting ESC[n;mR, where n is the row and m is the column.

Returns
ESC [6n

◆ ED0

string ansi.ANSI.ED0 = ESC+"[0J"
static

Clear from cursor to end of screen.

Returns
ESC [0J

◆ ED1

string ansi.ANSI.ED1 = ESC+"[1J"
static

Clear from cursor to beginning of the screen

Returns
ESC [1J

◆ ED2

string ansi.ANSI.ED2 = ESC+"[2J"
static

Clear entire screen (and moves cursor to upper left on DOS ANSI.SYS)

Returns
ESC [2J

◆ ED3

string ansi.ANSI.ED3 = ESC+"[3J"
static

Clear entire screen and delete all lines saved in the scrollback buffer (this feature was added for xterm and is supported by other terminal applications)

Returns
ESC [3J

◆ EL0

string ansi.ANSI.EL0 = ESC+"[0K"
static

Clear from cursor to the end of the line

Returns
ESC [0K

◆ EL1

string ansi.ANSI.EL1 = ESC+"[1K"
static

Clear from cursor to beginning of the line

Returns
ESC [1K

◆ EL2

string ansi.ANSI.EL2 = ESC+"[2K"
static

Clear entire line. Cursor position does not change.

Returns
ESC [2K

◆ ESC

string ansi.ANSI.ESC = "\u001B"
static

◆ FAINT

string ansi.ANSI.FAINT = ESC+"[2m"
static

◆ Franktur

string ansi.ANSI.Franktur = ESC+"[20m"
static

Rarely supported font

◆ GREEN

string ansi.ANSI.GREEN = ESC+"[32m"
static

◆ GREEN_HI

string ansi.ANSI.GREEN_HI = ESC+"[92m"
static

◆ HI_OFF

string ansi.ANSI.HI_OFF = ESC+"[22m"
static

◆ HIDE

string ansi.ANSI.HIDE = ESC+"[8m"
static

◆ ITALIC

string ansi.ANSI.ITALIC = ESC+"[3m"
static

◆ ITALIC_OFF

string ansi.ANSI.ITALIC_OFF = ESC+"[23m"
static

◆ OSC

string ansi.ANSI.OSC = "\u009D"
static

◆ PURPLE

string ansi.ANSI.PURPLE = ESC+"[35m"
static

◆ PURPLE_HI

string ansi.ANSI.PURPLE_HI = ESC+"[95m"
static

◆ RBLINK

string ansi.ANSI.RBLINK = ESC+"[6m"
static

◆ RCP

string ansi.ANSI.RCP = ESC+"[u"
static

Restores the cursor position/state in SCO console mode.

Returns
ESC [u

◆ RED

string ansi.ANSI.RED = ESC+"[31m"
static

◆ RED_HI

string ansi.ANSI.RED_HI = ESC+"[91m"
static

◆ RESET

string ansi.ANSI.RESET = ESC+"[0m"
static

◆ REVEAL

string ansi.ANSI.REVEAL = ESC+"[28m"
static

◆ REVERSE

string ansi.ANSI.REVERSE = ESC+"[7m"
static

◆ REVERSE_OFF

string ansi.ANSI.REVERSE_OFF = ESC+"[27m"
static

◆ SBLINK

string ansi.ANSI.SBLINK = ESC+"[5m"
static

◆ SCP

string ansi.ANSI.SCP = ESC+"[s"
static

Saves the cursor position/state in SCO console mode In vertical split screen mode, instead used to set (as CSI n ; n s) or reset left and right margins.

Returns
ESC [s

◆ SD1

string ansi.ANSI.SD1 = ESC+"[1T"
static

Scroll whole page down by 1 line

Returns
ESC [1T

◆ STRIKE

string ansi.ANSI.STRIKE = ESC+"[9m"
static

◆ STRIKE_OFF

string ansi.ANSI.STRIKE_OFF = ESC+"[29m"
static

◆ SU1

string ansi.ANSI.SU1 = ESC+"[1S"
static

Scroll whole page up by 1 line

Returns
ESC [1S

◆ UNDER

string ansi.ANSI.UNDER = ESC+"[4m"
static

◆ UNDER_OFF

string ansi.ANSI.UNDER_OFF = ESC+"[24m"
static

◆ WHITE

string ansi.ANSI.WHITE = ESC+"[37m"
static

◆ WHITE_HI

string ansi.ANSI.WHITE_HI = ESC+"[97m"
static

◆ YELLOW

string ansi.ANSI.YELLOW = ESC+"[33m"
static

◆ YELLOW_HI

string ansi.ANSI.YELLOW_HI = ESC+"[93m"
static

The documentation for this class was generated from the following file: