The following procedures emit escape sequences first introduced by XTerm, but which have since been adopted by other terminals.

[procedure](set-text256 attribs text #!optional (reset #t))

Change the colors and attributes of text (such as bold and underline) displayed on the screen. The following attributes are available, the same as set-text (symbols):

reset

bold

underscore

blink

reverse-video

concealed

Colors are specified with a two-element list, the first element being one of the symbols foreground or background followed by a number in the range 0..255. Most terminals use the same color palette by default: colors 0-15 are the familiar 16 terminal colors. Colors 17-232 form a 6x6x6 color cube, with the remaining 24 colors defining a grayscale ramp from dark to light.

[procedure](set-color256! index red green blue)

Redefine the RGB value of color index. The values red, green, blue are integers in the range 0..255. Be aware that some terminals which will output 256 colors won't necessarily honor this escape sequence.

This egg's source is distributed with a CHICKEN port of the 256colors2.pl program used to test a terminal's ability to display colors beyond the standard 16.