ColorMap Property  

Gets and sets the RGB value used when displaying color text attributes.


object.ColorMap(Index) [= color ]


The ColorMap property array provides access to the virtual display color table which determines what RGB values are used to display foreground and background text color attributes.

When the emulator processes an escape sequence that changes the current foreground or background color, the actual RGB color value is determined by looking up the value in the virtual display's color table. The ColorMap property is useful for determining what values are being used when a color attribute is set and enables an application to change those colors. The emulator currently supports a maximum of sixteen (16) color values, and the index into the table corresponds to the color as defined by the standard for ANSI terminals:

Index Color Default (Hex) Default (Integer) Default (RGB)
0 Black 0 0 RGB(0,0,0)
1 Red 000000A0h 160 RGB(160,0,0)
2 Green 0000A000h 40960 RGB(0,160,0)
3 Yellow 0000A0A0h 41120 RGB(160,160,0)
4 Blue 00A00000h 10485760 RGB(0,0,160)
5 Magenta 00A000A0h 10485920 RGB(160,0,160)
6 Cyan 00A0A000h 10526720 RGB(0,160,160)
7 White 00E0E0E0h 14737632 RGB(224,224,224)
8 Gray 00C0C0C0h 12632256 RGB(192,192,192)
9 Light Red 008080FFh 8421631 RGB(255,128,128)
10 Light Green 0090EE90h 9498256 RGB(144,238,144)
11 Light Yellow 00C0FFFFh 12648447 RGB(255,255,192)
12 Light Blue 00E6D8ADh 15128749 RGB(173,216,230)
13 Light Magenta 00FFC0FFh 16761087 RGB(255,192,255)
14 Light Cyan 00FFFFE0h 16777184 RGB(224,255,255)
15 High White 00FFFFFFh 16777215 RGB(255,255,255)

A standard ANSI color terminal supports eight standard colors (0-7). To select a foreground color, you add 30 to the color index and pass that value as a parameter to the SGR (select graphic rendition) escape sequence. To select a background color, you add 40 to the color index. For example, to set the current foreground color to white and the background color to blue, you could send the following escape sequence:

ESC [ 37;44 m

Note that if you wanted to set the foreground color to a bold version of standard yellow, you would first set the bold attribute, and then use the index value of 3, such as:

ESC [ 1;33m

Changing the value of the ColorMap property array allows the application to make selective changes to the actual RGB color value that is used when a color attribute is set. Note that changes to the color map will only affect new characters as they are displayed, not any previously displayed characters.

Data Type

Integer (Int32)

See Also

BackColor Property, BoldColor Property, Cell Property, ForeColor Property