|
|
| BOOL
NvtSetDisplayColorMap(
|
|
|
HDISPLAY
hDisplay, |
|
|
|
|
COLORREF
*lpColor, |
|
|
|
|
INT nColors |
|
|
| );
|
The NvtSetDisplayColorMap function modifies the virtual
display color table which determines what RGB values are used to
display foreground and background text color attributes.
Parameters
- hDisplay
- Handle to the virtual display.
- lpColor
- A pointer to an array of COLORREF values which specifies the
values to be used by the emulator when setting a color attribute.
If this value is NULL, the default color table will be loaded.
- nColors
- The number of colors which are stored in the array. The minimum
value for this parameter is 1, and the maximum value is 16.
Return Value
If the function succeeds, the return value is a non-zero value.
If the function fails, the return value is zero. Failure indicates
that the handle to the virtual display is invalid or the number of
color values is invalid.
Remarks
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 NvtSetDisplayColorMap function is useful
for changing what values are being used when a color attribute it
set. 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
The NvtSetDisplayColorMap function is used to modify the
actual color displayed by the emulator. For example, if the
emulator processes an escape sequence which sets the current
foreground color to white, the actual color displayed could be
changed to light green. Passing a NULL pointer as the second
parameter restores the original color map back to the default
values. Note that changes to the color map will only affect new
characters as they are displayed, not any previously displayed
characters.
Example
The following example will load the current color table for the
virtual display and change the standard white color attribute to
use the same value as the high-intensity white:
COLORREF rgbColor[16];
if ( NvtGetDisplayColorMap(hDisplay, rgbColor, 16) )
{
rgbColor[7] = rgbColor[15];
NvtSetDisplayColorMap(hDisplay, rgbColor, 16);
}
Requirements
Client: Requires Windows Vista, Windows XP or Windows
2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or
Windows 2000 Server.
Header: Include cstools6.h.
Library: Use csnvtav6.lib.
See Also
NvtGetDisplayColor,
NvtGetDisplayColorMap,
NvtGetTextColor, NvtSetDisplayColor, NvtSetTextColor
|
|