ANSI colors
From Mudpedia
Ansi Colors |
---|
Intensity | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
---|---|---|---|---|---|---|---|---|---|---|
Normal | Black | Red | Green | Yellow | Blue | Magenta | Cyan | White | Unused | Default |
Bold | Black | Red | Green | Yellow | Blue | Magenta | Cyan | White | Unused | Default |
SGR (Select Graphic Rendition) parameters |
---|
Code | Effect | Note |
---|---|---|
0 | Reset | all attributes off |
1 | Bold | |
4 | Underline | |
5 | Blink | |
7 | Reverse video | swap foreground and background colors |
22 | Bold: off | |
24 | Underline: off | |
25 | Blink: off | |
27 | Reverse video: off | |
30–37 | Set foreground color | |
39 | Set default foreground color | |
40–47 | Set background color | |
49 | Set default background color |
Detection
There is no universal standard for the detection or negotiation of ANSI color support. The following generic methods exist:
- By using the TTYPE TELNET option and checking for a terminal emulator or mud client known to support ANSI colors, such as xterm.
- By using the TTYPE TELNET option and checking for the -color suffix, such as xterm-color.
- By using the TTYPE TELNET option and checking for the MTTS extension to detect ANSI color support.
- By using the MSDP TELNET option and checking if the client set the ANSI_COLORS variable to 1.
Note that most muds either assume the client supports ANSI color, or ask the user during login if they wish to use color.