![]() |
ANSI-Project 1.0
Make quick ANSI formats to beautify terminal output
|
Functions | |
| def | SGR (str) |
| Sets colors and style of the characters following this code Example: ansi.SGR("4091") makes RED_HI over BK_BLACK. More... | |
| def | RGB (r, g, b) |
| Specify the Foreground color in RGB. More... | |
| def | BK_RGB (r, g, b) |
| Specify the Background color in RGB. More... | |
| def | CUU (n) |
| Moves the cursor n (default 1) cells up. More... | |
| def | CUD (n) |
| Moves the cursor n (default 1) cells down. More... | |
| def | CUF (n) |
| Moves the cursor n (default 1) cells forwards. More... | |
| def | CUB (n) |
| Moves the cursor n (default 1) cells backwards. More... | |
| def | CNL (n) |
| Moves cursor to beginning of the line n (default 1) lines down. More... | |
| def | CPL (n) |
| Moves cursor to beginning of the line n (default 1) lines up. More... | |
| def | CHA (n) |
| Moves the cursor to column n (default 1) More... | |
| def | CUP (row, col) |
| Moves the cursor to [row, column]. More... | |
| def | ED (n) |
| Clears part of the screen. More... | |
| def | EL (n) |
| 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. More... | |
| def | SU (n) |
| Scroll whole page up by n (default 1) lines. More... | |
| def | SD (n) |
| Scroll whole page down by n (default 1) lines. More... | |
| def | HVP (row, col) |
| 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. More... | |
| def | custom (str) |
| Returns a custom ANSI ESCAPE SEQUENCE. More... | |
Variables | |
| string | ESC = "\u001B" |
| string | CSI = "\u009B" |
| string | DSC = "\u0090" |
| string | OSC = "\u009D" |
| string | RESET = ESC+"[0m" |
| string | BOLD = ESC+"[1m" |
| string | FAINT = ESC+"[2m" |
| string | ITALIC = ESC+"[3m" |
| string | UNDER = ESC+"[4m" |
| string | SBLINK = ESC+"[5m" |
| string | RBLINK = ESC+"[6m" |
| string | REVERSE = ESC+"[7m" |
| string | HIDE = ESC+"[8m" |
| string | STRIKE = ESC+"[9m" |
| string | DEF_FONT = ESC+"[10m" |
| Default font. More... | |
| string | Franktur = ESC+"[20m" |
| Rarely supported font. More... | |
| string | BOLD_OFF = ESC+"[21m" |
| string | HI_OFF = ESC+"[22m" |
| string | ITALIC_OFF = ESC+"[23m" |
| string | UNDER_OFF = ESC+"[24m" |
| string | BLINK_OFF = ESC+"[25m" |
| string | REVERSE_OFF = ESC+"[27m" |
| string | REVEAL = ESC+"[28m" |
| string | STRIKE_OFF = ESC+"[29m" |
| string | BLACK = ESC+"[30m" |
| string | RED = ESC+"[31m" |
| string | GREEN = ESC+"[32m" |
| string | YELLOW = ESC+"[33m" |
| string | BLUE = ESC+"[34m" |
| string | PURPLE = ESC+"[35m" |
| string | CYAN = ESC+"[36m" |
| string | WHITE = ESC+"[37m" |
| string | DEFAULT = ESC+"[39m" |
| string | BK_BLACK = ESC+"[40m" |
| string | BK_RED = ESC+"[41m" |
| string | BK_GREEN = ESC+"[42m" |
| string | BK_YELLOW = ESC+"[43m" |
| string | BK_BLUE = ESC+"[44m" |
| string | BK_PURPLE = ESC+"[45m" |
| string | BK_CYAN = ESC+"[46m" |
| string | BK_WHITE = ESC+"[47m" |
| string | BK_DEFAULT = ESC+"[49m" |
| string | BLACK_HI = ESC+"[90m" |
| string | RED_HI = ESC+"[91m" |
| string | GREEN_HI = ESC+"[92m" |
| string | YELLOW_HI = ESC+"[93m" |
| string | BLUE_HI = ESC+"[94m" |
| string | PURPLE_HI = ESC+"[95m" |
| string | CYAN_HI = ESC+"[96m" |
| string | WHITE_HI = ESC+"[97m" |
| string | BK_BLACK_HI = ESC+"[100m" |
| string | BK_RED_HI = ESC+"[101m" |
| string | BK_GREEN_HI = ESC+"[102m" |
| string | BK_YELLOW_HI = ESC+"[103m" |
| string | BK_BLUE_HI = ESC+"[104m" |
| string | BK_PURPLE_HI = ESC+"[105m" |
| string | BK_CYAN_HI = ESC+"[106m" |
| string | BK_WHITE_HI = ESC+"[107m" |
| string | C0 = ESC+"[11H" |
| Place the cursor in top-left corner Same as CUP(1,1) More... | |
| string | CUU1 = ESC+"[1A" |
| Move the cursor 1 row up. More... | |
| string | CUD1 = ESC+"[1B" |
| Move the cursor 1 row down. More... | |
| string | CUF1 = ESC+"[1C" |
| Move the cursor 1 cell forwards. More... | |
| string | CUB1 = ESC+"[1D" |
| Move the cursor 1 cell backwards. More... | |
| string | CNL1 = ESC+"[1E" |
| Moves cursor to beginning of the next line. More... | |
| string | CPL1 = ESC+"[1F" |
| Moves cursor to beginning of the previous line. More... | |
| string | SU1 = ESC+"[1S" |
| Scroll whole page up by 1 line. More... | |
| string | SD1 = ESC+"[1T" |
| Scroll whole page down by 1 line. More... | |
| string | ED0 = ESC+"[0J" |
| Clear from cursor to end of screen. More... | |
| string | ED1 = ESC+"[1J" |
| Clear from cursor to beginning of the screen. More... | |
| string | ED2 = ESC+"[2J" |
| Clear entire screen (and moves cursor to upper left on DOS ANSI.SYS) More... | |
| string | ED3 = ESC+"[3J" |
| 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) More... | |
| string | EL0 = ESC+"[0K" |
| Clear from cursor to the end of the line. More... | |
| string | EL1 = ESC+"[1K" |
| Clear from cursor to beginning of the line. More... | |
| string | EL2 = ESC+"[2K" |
| Clear entire line. More... | |
| string | AUX_PORT_ON = ESC+"[5i" |
| Enable aux serial port usually for local serial printer. More... | |
| string | AUX_PORT_OFF = ESC+"[4i" |
| Enable aux serial port usually for local serial printer. More... | |
| string | DSR = ESC+"[6n" |
| Reports the cursor position (CPR) by transmitting ESC[nmR, where n is the row and m is the column. More... | |
| string | SCP = ESC+"[s" |
| 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. More... | |
| string | RCP = ESC+"[u" |
| Restores the cursor position/state in SCO console mode. More... | |
| def ansi.BK_RGB | ( | r, | |
| g, | |||
| b | |||
| ) |
Specify the Background color in RGB.
| r | (int) Red value |
| g | (int) Green value |
| b | (int) Blue value |
| def ansi.CHA | ( | n | ) |
Moves the cursor to column n (default 1)
| n | (int) |
| def ansi.CNL | ( | n | ) |
Moves cursor to beginning of the line n (default 1) lines down.
| n | (int) |
| def ansi.CPL | ( | n | ) |
Moves cursor to beginning of the line n (default 1) lines up.
| n | (int) |
| def ansi.CUB | ( | n | ) |
Moves the cursor n (default 1) cells backwards.
| n | (int) |
| def ansi.CUD | ( | n | ) |
Moves the cursor n (default 1) cells down.
| n | (int) |
| def ansi.CUF | ( | n | ) |
Moves the cursor n (default 1) cells forwards.
| n | (int) |
| def ansi.CUP | ( | row, | |
| col | |||
| ) |
Moves the cursor to [row, column].
The values are 1-based.
| row | (int) |
| col | (int) |
| def ansi.custom | ( | str | ) |
Returns a custom ANSI ESCAPE SEQUENCE.
| str | (String) |
| def ansi.CUU | ( | n | ) |
Moves the cursor n (default 1) cells up.
| n | (int) |
| def ansi.ED | ( | n | ) |
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).
| n | (int) |
| def ansi.EL | ( | n | ) |
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.
| n | (int) |
| def ansi.HVP | ( | row, | |
| col | |||
| ) |
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.
| row | (int) |
| col | (int) |
| def ansi.RGB | ( | r, | |
| g, | |||
| b | |||
| ) |
Specify the Foreground color in RGB.
| r | (int) Red value |
| g | (int) Green value |
| b | (int) Blue value |
| def ansi.SD | ( | n | ) |
Scroll whole page down by n (default 1) lines.
New lines are added at the top. (not ANSI.SYS)
| n | (int) |
| def ansi.SGR | ( | str | ) |
Sets colors and style of the characters following this code Example: ansi.SGR("4091") makes RED_HI over BK_BLACK.
| str | (String) |
| def ansi.SU | ( | n | ) |
Scroll whole page up by n (default 1) lines.
New lines are added at the bottom. (not ANSI.SYS)
| n | (int) |
| string ansi.AUX_PORT_OFF = ESC+"[4i" |
Enable aux serial port usually for local serial printer.
| string ansi.AUX_PORT_ON = ESC+"[5i" |
Enable aux serial port usually for local serial printer.
| string ansi.BK_BLACK = ESC+"[40m" |
| string ansi.BK_BLACK_HI = ESC+"[100m" |
| string ansi.BK_BLUE = ESC+"[44m" |
| string ansi.BK_BLUE_HI = ESC+"[104m" |
| string ansi.BK_CYAN = ESC+"[46m" |
| string ansi.BK_CYAN_HI = ESC+"[106m" |
| string ansi.BK_DEFAULT = ESC+"[49m" |
| string ansi.BK_GREEN = ESC+"[42m" |
| string ansi.BK_GREEN_HI = ESC+"[102m" |
| string ansi.BK_PURPLE = ESC+"[45m" |
| string ansi.BK_PURPLE_HI = ESC+"[105m" |
| string ansi.BK_RED = ESC+"[41m" |
| string ansi.BK_RED_HI = ESC+"[101m" |
| string ansi.BK_WHITE = ESC+"[47m" |
| string ansi.BK_WHITE_HI = ESC+"[107m" |
| string ansi.BK_YELLOW = ESC+"[43m" |
| string ansi.BK_YELLOW_HI = ESC+"[103m" |
| string ansi.BLACK = ESC+"[30m" |
| string ansi.BLACK_HI = ESC+"[90m" |
| string ansi.BLINK_OFF = ESC+"[25m" |
| string ansi.BLUE = ESC+"[34m" |
| string ansi.BLUE_HI = ESC+"[94m" |
| string ansi.BOLD = ESC+"[1m" |
| string ansi.BOLD_OFF = ESC+"[21m" |
| string ansi.C0 = ESC+"[11H" |
Place the cursor in top-left corner Same as CUP(1,1)
| string ansi.CNL1 = ESC+"[1E" |
Moves cursor to beginning of the next line.
| string ansi.CPL1 = ESC+"[1F" |
Moves cursor to beginning of the previous line.
| string ansi.CSI = "\u009B" |
| string ansi.CUB1 = ESC+"[1D" |
Move the cursor 1 cell backwards.
| string ansi.CUD1 = ESC+"[1B" |
Move the cursor 1 row down.
| string ansi.CUF1 = ESC+"[1C" |
Move the cursor 1 cell forwards.
| string ansi.CUU1 = ESC+"[1A" |
Move the cursor 1 row up.
| string ansi.CYAN = ESC+"[36m" |
| string ansi.CYAN_HI = ESC+"[96m" |
| string ansi.DEF_FONT = ESC+"[10m" |
Default font.
| string ansi.DEFAULT = ESC+"[39m" |
| string ansi.DSC = "\u0090" |
| string ansi.DSR = ESC+"[6n" |
Reports the cursor position (CPR) by transmitting ESC[nmR, where n is the row and m is the column.
| string ansi.ED0 = ESC+"[0J" |
Clear from cursor to end of screen.
| string ansi.ED1 = ESC+"[1J" |
Clear from cursor to beginning of the screen.
| string ansi.ED2 = ESC+"[2J" |
Clear entire screen (and moves cursor to upper left on DOS ANSI.SYS)
| string ansi.ED3 = ESC+"[3J" |
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)
| string ansi.EL0 = ESC+"[0K" |
Clear from cursor to the end of the line.
| string ansi.EL1 = ESC+"[1K" |
Clear from cursor to beginning of the line.
| string ansi.EL2 = ESC+"[2K" |
Clear entire line.
Cursor position does not change.
| string ansi.ESC = "\u001B" |
| string ansi.FAINT = ESC+"[2m" |
| string ansi.Franktur = ESC+"[20m" |
Rarely supported font.
| string ansi.GREEN = ESC+"[32m" |
| string ansi.GREEN_HI = ESC+"[92m" |
| string ansi.HI_OFF = ESC+"[22m" |
| string ansi.HIDE = ESC+"[8m" |
| string ansi.ITALIC = ESC+"[3m" |
| string ansi.ITALIC_OFF = ESC+"[23m" |
| string ansi.OSC = "\u009D" |
| string ansi.PURPLE = ESC+"[35m" |
| string ansi.PURPLE_HI = ESC+"[95m" |
| string ansi.RBLINK = ESC+"[6m" |
| string ansi.RCP = ESC+"[u" |
Restores the cursor position/state in SCO console mode.
| string ansi.RED = ESC+"[31m" |
| string ansi.RED_HI = ESC+"[91m" |
| string ansi.RESET = ESC+"[0m" |
| string ansi.REVEAL = ESC+"[28m" |
| string ansi.REVERSE = ESC+"[7m" |
| string ansi.REVERSE_OFF = ESC+"[27m" |
| string ansi.SBLINK = ESC+"[5m" |
| string ansi.SCP = ESC+"[s" |
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.
| string ansi.SD1 = ESC+"[1T" |
Scroll whole page down by 1 line.
| string ansi.STRIKE = ESC+"[9m" |
| string ansi.STRIKE_OFF = ESC+"[29m" |
| string ansi.SU1 = ESC+"[1S" |
Scroll whole page up by 1 line.
| string ansi.UNDER = ESC+"[4m" |
| string ansi.UNDER_OFF = ESC+"[24m" |
| string ansi.WHITE = ESC+"[37m" |
| string ansi.WHITE_HI = ESC+"[97m" |
| string ansi.YELLOW = ESC+"[33m" |
| string ansi.YELLOW_HI = ESC+"[93m" |