-
Notifications
You must be signed in to change notification settings - Fork 11
String To Elements Protocol
Some components may require colours or other types of manipulation. For example, drawing a border on an image component using the extended ASCII drawing characters could require changing the character set to SCO mode, and outputting a character code not normally found on a keyboard.
This document describes a method whereby these codes can be placed in-line in text, so that a function may convert this to an array of element_type and be output to the user.
- \\: \
- \x: set all attributes to their default values
E.g. \x
- \C???
??? = 000..255: the character to display.
E.g. \C097 = the 'a' character.
- \U????
???? = 0000..FFFF: the hexcode of the character to display.
E.g. \U16DD = the 'ᛝ' character.
- \c?
- ? = x: default character set (currently US ASCII)
- ? = A: UK
- ? = B: US ASCII
- ? = 0: DEC
- ? = U: SCO
E.g. \c0
- \i?
- ? = x: default intensity (currenly normal)
- ? = >: bold intensity
- ? = =: normal intensity
- ? = <: faint intensity
E.g. \i>
- \p?
- ? = x: default polarity (currently positive)
- ? = +: positive polarity
- ? = -: negative polarity
E.g. \p-
- \u?
- ? = x: default underlining (currently off)
- ? = +: underlining on
- ? = -: underlining off
E.g. \u+
See http://www.mudpedia.org/wiki/ANSI_colors for exact colours
- \[?
- ? = 0..9: change the foreground colour.
- \]?
- ? = 0..9: change the background colour.
E.g. \[6\]0 (cyan on a black background)
See http://www.mudpedia.org/wiki/Xterm_256_colors for exact colour codes. Note that there are three segments: overlap with the original 16 colours (the only place where true black lies), a central coloured section of 216 colours, a greyscale section of 24 colours.
For the overlap with the original 16 colours, use the 16-colour codes above.
- \<?R?G?B
- ?R = 0..5: intensity of red value as foreground
- ?G = 0..5: intensity of green value as foreground
- ?B = 0..5: intensity of blue value as foreground To match up to the colour chart, the following conversion is applied:
colour = (?R x 36) + (?G x 6) + (?B) + 16
E.g. \<510: (5 x 36) + (1 x 6) + (0) + 16 = foreground colour 202, a deep orange.
- \>?R?G?B
- ?R = 0..5: intensity of red value as background
- ?G = 0..5: intensity of green value as background
- ?B = 0..5: intensity of blue value as background
See above for colour chart meanings.
E.g. \>135: (1 x 36) + (3 x 6) + (5) + 16 = background colour 75, a greeny-blue.
- \{?
- ? = 0..23: grey intensity as foreground
colour = ? + 232
E.g. \\{12: = 12 + 232 = colour 244, a medium grey on the foreground.
- \}?
- ? = 0..23: grey intensity as background
See above for colour chart meanings.
E.g. \\}23: = 23 + 232 = colour 255, off-white on the background.
\i>\[1\]3\cU\C201 = A bright red foreground, yellow background, double-lined top left corner glyph (╔).