Class: ANSI
runtime/ansi.ANSI
Table of contents
Constructors
Properties
Methods
- attr
- attrToAnsi
- clearScreen
- color
- disableIceColors
- enableIceColors
- getFontFromAlias
- gotoxy
- hideCursor
- queryDeviceAttributes
- reset
- setCursorStyle
- setEmulatedBaudRate
- setSyncTermFont
- setSyncTermFontWithAlias
- showCursor
- telnetCommand
Constructors
constructor
• new ANSI()
Properties
CGA
▪ Static Readonly CGA: Object = CGA
CGA attribute constants (re-exported for convenience)
Type declaration
| Name | Type |
|---|---|
BG_BLACK |
0 |
BG_BLUE |
16 |
BG_BROWN |
96 |
BG_CYAN |
48 |
BG_GREEN |
32 |
BG_LIGHTGRAY |
112 |
BG_MAGENTA |
80 |
BG_RED |
64 |
BLACK |
0 |
BLINK |
128 |
BLUE |
1 |
BROWN |
6 |
CYAN |
3 |
DARKGRAY |
8 |
GREEN |
2 |
HIGH |
8 |
LIGHTBLUE |
9 |
LIGHTCYAN |
11 |
LIGHTGRAY |
7 |
LIGHTGREEN |
10 |
LIGHTMAGENTA |
13 |
LIGHTRED |
12 |
MAGENTA |
5 |
RED |
4 |
WHITE |
15 |
YELLOW |
14 |
Defined in
bgColors
▪ Static bgColors: Object
Background colors
Type declaration
| Name | Type |
|---|---|
black |
string |
blue |
string |
brightBlack |
string |
brightBlue |
string |
brightCyan |
string |
brightGreen |
string |
brightMagenta |
string |
brightRed |
string |
brightWhite |
string |
brightYellow |
string |
cyan |
string |
green |
string |
magenta |
string |
red |
string |
white |
string |
yellow |
string |
Defined in
colors
▪ Static colors: Object
Foreground colors
Type declaration
| Name | Type |
|---|---|
black |
string |
blue |
string |
brightBlack |
string |
brightBlue |
string |
brightCyan |
string |
brightGreen |
string |
brightMagenta |
string |
brightRed |
string |
brightWhite |
string |
brightYellow |
string |
cyan |
string |
green |
string |
magenta |
string |
red |
string |
white |
string |
yellow |
string |
Defined in
cursor
▪ Static cursor: Object
Cursor movement
Type declaration
| Name | Type |
|---|---|
down |
(n: number) => string |
hide |
() => string |
left |
(n: number) => string |
restore |
() => string |
right |
(n: number) => string |
save |
() => string |
show |
() => string |
up |
(n: number) => string |
Defined in
cursorStyles
▪ Static cursorStyles: Object
Cursor style control (DEC)
Index signature
▪ [key: string]: number
Defined in
fontAliases
▪ Static fontAliases: Object
Font alias mapping for SAUCE compatibility Maps common SAUCE font names to SyncTERM font names
Index signature
▪ [key: string]: string
Defined in
syncTermFonts
▪ Static syncTermFonts: Object
SyncTERM/CTerm Font Table Maps font names to their ESC sequence codes See: https://github.com/protomouse/synchronet/blob/master/src/conio/cterm.txt
Index signature
▪ [key: string]: number
Defined in
telnet
▪ Static telnet: Object
Telnet protocol commands
Type declaration
| Name | Type |
|---|---|
DO |
number |
DONT |
number |
ECHO |
number |
IAC |
number |
LINEMODE |
number |
NAWS |
number |
SB |
number |
SE |
number |
SUPPRESS_GO_AHEAD |
number |
TERMINAL_TYPE |
number |
WILL |
number |
WONT |
number |
Defined in
Methods
attr
▸ Static attr(fg, bg?, blink?, high?): number
Create a CGA attribute from foreground, background, and flags
Parameters
| Name | Type | Default value |
|---|---|---|
fg |
number |
undefined |
bg |
number |
0 |
blink |
boolean |
false |
high |
boolean |
false |
Returns
number
Defined in
attrToAnsi
▸ Static attrToAnsi(attr): string
Convert CGA attribute to ANSI escape sequence
Parameters
| Name | Type |
|---|---|
attr |
number |
Returns
string
Defined in
clearScreen
▸ Static clearScreen(): string
Clear the entire screen and move cursor to home position
Returns
string
Defined in
color
▸ Static color(name): string
Get color code by name
Parameters
| Name | Type |
|---|---|
name |
string |
Returns
string
Defined in
disableIceColors
▸ Static disableIceColors(): string
Returns
string
Defined in
enableIceColors
▸ Static enableIceColors(): string
iCE Colors - Blink to Bright Intensity Converts blink attribute (bit 7) to bright background colors Essential for most modern BBS ANSI art
Returns
string
Defined in
getFontFromAlias
▸ Static getFontFromAlias(alias): undefined | string
Get SyncTERM font name from alias (e.g., SAUCE font name)
Parameters
| Name | Type |
|---|---|
alias |
string |
Returns
undefined | string
Defined in
gotoxy
▸ Static gotoxy(x, y): string
Move cursor to specific position (1-indexed)
Parameters
| Name | Type |
|---|---|
x |
number |
y |
number |
Returns
string
Defined in
hideCursor
▸ Static hideCursor(): string
Hide cursor (non-standard, widely supported)
Returns
string
Defined in
queryDeviceAttributes
▸ Static queryDeviceAttributes(): string
Query device attributes (for terminal detection)
Returns
string
Defined in
reset
▸ Static reset(): string
Reset all attributes
Returns
string
Defined in
setCursorStyle
▸ Static setCursorStyle(style): string
Parameters
| Name | Type |
|---|---|
style |
string |
Returns
string
Defined in
setEmulatedBaudRate
▸ Static setEmulatedBaudRate(rate): string
Set emulated baud rate (CTerm/SyncTERM)
Parameters
| Name | Type | Description |
|---|---|---|
rate |
string | number |
Baud rate (300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 76800, 115200, or 0/’unlimited’) |
Returns
string
Defined in
setSyncTermFont
▸ Static setSyncTermFont(fontName, page?): string
Set SyncTERM font
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
fontName |
string |
undefined |
Font name (from syncTermFonts table) |
page |
number |
0 |
Font page (0-3, default 0) |
Returns
string
Defined in
setSyncTermFontWithAlias
▸ Static setSyncTermFontWithAlias(aliasOrName, page?): string
Set SyncTERM font using alias (handles SAUCE font names)
Parameters
| Name | Type | Default value |
|---|---|---|
aliasOrName |
string |
undefined |
page |
number |
0 |
Returns
string
Defined in
showCursor
▸ Static showCursor(): string
Show cursor (non-standard, widely supported)
Returns
string
Defined in
telnetCommand
▸ Static telnetCommand(command, option): Buffer
Create Telnet negotiation sequence
Parameters
| Name | Type |
|---|---|
command |
number |
option |
number |
Returns
Buffer