You can use color names in several configuration options and in some internal commands. The general form of a color specification is:
[BRIght] fg ON [BRIght] bg
where fg is the foreground or text color, and bg is the background color.
Color Names
Color names as well as the attribute name BRIght may be shortened to their first three letters. The available color names, shown below on approximations of the 8 basic background colors, are: BLAck, BLUe, GREen, CYAn, RED, MAGenta, YELlow, WHIte.
BLAck |
BLUe |
GREen |
CYAn |
RED |
MAGenta |
YELlow |
WHIte |
BLAck |
BLUe |
GREen |
CYAn |
RED |
MAGenta |
YELlow |
WHIte |
BLAck |
BLUe |
GREen |
CYAn |
RED |
MAGenta |
YELlow |
WHIte |
BLAck |
BLUe |
GREen |
CYAn |
RED |
MAGenta |
YELlow |
WHIte |
BLAck |
BLUe |
GREen |
CYAn |
RED |
MAGenta |
YELlow |
WHIte |
BLAck |
BLUe |
GREen |
CYAn |
RED |
MAGenta |
YELlow |
WHIte |
BLAck |
BLUe |
GREen |
CYAn |
RED |
MAGenta |
YELlow |
WHIte |
BLAck |
BLUe |
GREen |
CYAn |
RED |
MAGenta |
YELlow |
WHIte |
Note: The colors (if any) represented by your viewer in the above table do not necessarily match the actual rendition provided by your display hardware and drivers at a TCC prompt. BRIght backgrounds are generally always enabled under Windows.
Color Codes
You can also specify colors by numeric code (see table below) instead of by name. The numeric form is most useful in potentially long options such as ColorDIR, where using color names may take too much space. The codes are decimal numbers, with the codes for bright colors larger than those of the corresponding normal colors by 8.
The COLOR command also supports the CMD style color specification bf, where b and f are CMD.EXE's codes for background and foreground colors, respectively (shown in the CMD columns of the table below). The numeric values of these codes are the same as the TCC codes, but they are represented in hexadecimal.
ANSI X3.64 color codes are also shown in the table. Note that X3.64 support for the bright attribute is restricted to foreground. Note that the color codes are decimal, and the codes for background colors are larger than those of the corresponding foreground colors by 10.
SCREEN COLOR |
TCC name |
TCC codes (decimal) |
CMD codes* (hexadecimal) |
ANSI X3.64 codes (decimal) |
|||||
normal |
bright |
normal |
bright |
normal |
bright |
foreground |
background |
||
black |
gray |
BLAck |
0 |
8 |
0 |
8 |
30 |
40 |
|
blue |
blue |
BLUe |
1 |
9 |
1 |
9 |
34 |
44 |
|
green |
green |
GREen |
2 |
10 |
2 |
A |
32 |
42 |
|
cyan |
cyan |
CYAn |
3 |
11 |
3 |
B |
36 |
46 |
|
red |
pink |
RED |
4 |
12 |
4 |
C |
31 |
41 |
|
magenta |
magenta |
MAGenta |
5 |
13 |
5 |
D |
35 |
45 |
|
brown |
yellow |
YELlow |
6 |
14 |
6 |
E |
33 |
43 |
|
white |
white |
WHIte |
7 |
15 |
7 |
F |
37 |
47 |
Note: The numeric values of the CMD and native color codes are identical, the difference is in representation only.
Use one number to substitute for the [BRIght] fg portion of the color name, and a second to substitute for the [BRIght] bg portion. For example, instead of bright white on red you could use 15 on 4 to save space in a ColorDir specification.
The @OPTION function returns the value of color configuration options by combining both foreground and background into a single number (0-255) using the following logic:
foreground value + ( background value * 16 ) = code
For example, bright white on red (15 on 4) can be expressed as:
15 + ( 4 * 16 ) = 79
The following batch file translates a combined numeric color code:
@echo off
setlocal
function x=`%@if[%1 gt 8,bri ,]%@word[%@eval[%1 %% 8],bla blu gre cya red mag yel whi]`
:loop
input /c /d ^nColor code? %%c
if %c gt 255 .or. %c lt 0 quit
set f=%@eval[%c %% 16] & set b=%@eval[%c \ 16]
echos The color code %c is "%f on %b" ("%@x[%f] on %@x[%b]")
goto loop
Color Errors
A standard color specification allows sixteen foreground and sixteen background colors. However, many monitors do not provide true renditions of certain colors. For example, most users see normal "yellow" as brown, and bright yellow as yellow; many also see normal red as red, and "bright red" as pink. Color errors are often worse when running in windowed mode, because Windows may not map the text-mode colors the way you expect. These problems are inherent in the monitor and they cannot be corrected using the Take Command color specifications. You can, however, define a custom color palette to get the exact colors you want, via the "Tab Colors" button on the Configure Take Command / Tab dialog.