module BBS::Ansi
The ANSI escape sequences and line ends a board writes to the callerโs terminal, and the patterns that find escape sequences in text, in one place for every class that writes or measures ANSI text.
session.write("#{BBS::Ansi::CLEAR}#{BBS::Ansi::BRIGHT_GREEN}Hi#{BBS::Ansi::RESET}#{BBS::Ansi::CRLF}")
Constants
- BG_BLACK
-
SGR: black background.
- BLUE
-
SGR: blue text.
- BRIGHT_BLUE
-
SGR: bright blue text.
- BRIGHT_CYAN
-
SGR: bright cyan text.
- BRIGHT_GREEN
-
SGR: bright green text.
- BRIGHT_RED
-
SGR: bright red text.
- BRIGHT_YELLOW
-
SGR: bright yellow text.
- CLEAR
-
Erases the screen and moves the cursor to the top left corner.
- CLEAR_SCREEN
-
Erases the whole screen; the cursor stays where it is.
- CR
-
Carriage return alone: back to the start of the line.
- CRLF
-
Line end on the telnet line: carriage return and line feed.
- CSI
-
Control Sequence Introducer:
ESCand a left bracket. - CSI_BYTE
- CSI_FINAL
-
The final byte of a
CSIsequence: a letter or~. - CSI_LETTER
-
A letter, the final byte of a
CSIsequence that ends with one. - CSI_RE
-
A
CSIsequence with digit, semicolon and?parameters and a letter or~final byte: the one pattern rubbs finds escape sequences in text with. - CURSOR_HOME
-
Moves the cursor to the top left corner.
- CYAN
-
SGR: cyan text.
- DARK_GREY
-
SGR: dark grey (bold black) text.
- DIM_GREY
-
SGR: dim grey text.
- ESC
-
The escape character that starts every sequence.
- GREEN
-
SGR: green text.
- GREY
-
SGR: grey (normal white) text, the colour of plain text.
- HIDE_CURSOR
-
Hides the cursor.
- MAGENTA
-
SGR: magenta text.
- MAX_CSI_LENGTH
-
The most parameter bytes read before a
CSIsequence is given up. - RESET
-
SGR reset: default colours and attributes.
- REVERSE
-
SGR: reverse video on (RVS ON on a C64).
- REVERSE_OFF
-
SGR: reverse video off (RVS OFF on a C64).
- SHOW_CURSOR
-
Shows the cursor.
- WHITE
-
SGR: bright white text.
- YELLOW
-
SGR: yellow (brown) text.