[Toc][Index]

Colors and Color Names


You can use color names in several of the directives in the .INI file and 
in many commands.  The general form of a color name is: 
        [BRIght] [BLInk] fg ON [BRIght] bg [BORder bc ] 
where fg is the foreground or text color, bg is the background color, and 
bc is the border color. 
The available colors are: 


        Black           Blue            Green           Red
        Magenta         Cyan            Yellow          White

Color names and the words BRIght, BLInk, and BORder may be shortened to 
the first 3 letters. 
You can also specify colors by number instead of by name.  The numbers are 
most useful in potentially long .INI file directives like ColorDir, where 
using color names may take too much space.  The following numbers are 
recognized: 


        0 - Black       8 - Gray (bright black)
        1 - Blue        9 - Bright blue
        2 - Green      10 - Bright green
        3 - Cyan       11 - Bright cyan
        4 - Red        12 - Bright red
        5 - Magenta    13 - Bright magenta
        6 - Yellow     14 - Bright yellow
        7 - White      15 - Bright white

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 cyan on blue you could use 11 on 1 to save 
space in a ColorDir specification. 
There are several subtleties that complicate the use of colors and color 
names.  In order to understand them, you will need to read through the 
restrictions described below.  These restrictions are due to the design of 
your PC video hardware and video drivers, and are not inherent in CMD.EXE. 
 Some of the restrictions are complex, so feel free to skip over those 
that do not apply to color combinations you use. 
Some restrictions depend on the display "mode."  CMD.EXE can run in either 
full-screen display mode, where it uses the entire screen and has more 
direct control over the video hardware; or in windowed display mode, where 
it appears in a window on the OS/2 desktop. 

Color Errors 
A standard color specification allows sixteen foreground and eight 
background colors (sixteen if bright backgrounds are enabled, see below). 
 However, most video adapters and 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 much worse when running in windowed 
mode (see above), because the graphical environment that created the 
window may not map the text-mode colors the way you expect.  These 
problems are inherent in the monitor, video adapter, and driver software. 
 They cannot be corrected using CMD.EXE color specifications. 

Border Colors 
In order to use border colors, you must have a color video adapter 
(monochrome adapters do not support border colors). 
CMD.EXE can only accept border colors in the CLS and COLOR commands, and 
in the StdColors directive in the .INI file.  Border colors will be 
ignored, or will cause an error, if they are used elsewhere. 
Border colors do not work in windowed mode, and will be ignored if used in 
a windowed session under OS/2. 

Blinking Text and Bright Background Colors 
The interactions between blinking characters, bright backgrounds, and your 
display mode can be complex.  You will need to understand them if you use 
either attribute in your color specifications. 
The effects of blinking and bright background color specifications depend 
partly on whether you are in full-screen or windowed display mode. 

Full-Screen Display Mode 
Full-screen display mode uses the entire screen for your command processor 
or application.  This mode is available as an option for text-mode 
sessions in OS/2. 
In full-screen display mode your video hardware can be configured via 
software commands to display either blinking text, or text with a bright 
background, but not both.  This is due to the design of PC video hardware, 
and is not a software restriction. 
The memory on your video adapter includes a "flag" for each character on 
the screen.  The flag controls blinking text and bright background colors. 
 If the flag is off, the character is displayed with a normal background 
and does not blink.  If the flag is "on," the character either blinks or 
is displayed with a bright background, depending on which way your video 
adapter is currently configured. 
In full-screen display mode, the configuration of your video adapter can 
be controlled by CMD.EXE with the BrightBG directive in the CMD.INI file 
or the SETDOS /B command.  If you set BrightBG = No or use the SETDOS /B0 
command, CMD.EXE will configure the video adapter for blinking text, and 
all characters on the screen with the blink / bright background flag set 
will blink.  If you set BrightBG = Yes or use SETDOS /B1, CMD.EXE will 
configure the video adapter for bright background colors, and the 
characters will be displayed with a bright background instead of blinking. 

Because there is only one flag for each character to specify both blinking 
text and bright background color, it doesn't matter which attribute you 
use when you specify the color.  Whether you specify blinking text or a 
bright background, you will see the same thing on your screen.  For 
example, these two COLOR commands will always produce the same results: 


        color blink white on blue
        color white on bright blue

If bright backgrounds are enabled, both commands will produce white text 
on a bright blue background.  If blinking text is enabled, both commands 
will produce blinking white text on a blue background. 
If you don't use BrightBG or SETDOS /B, or if you use SETDOS /B2, CMD.EXE 
will not attempt to configure your video hardware.  Most video adapters 
default to blinking text in full-screen mode, but this can be changed by 
application programs.  If you use BrightBG or SETDOS /B, CMD.EXE will 
configure the hardware each time it displays the prompt. 

Windowed Display Mode 
Windowed display mode uses a window on the screen for your command 
processor or text-mode application.  It is available for command processor 
sessions and most applications running under OS/2. 
In windowed mode, CMD.EXE cannot control your hardware to select blinking 
or bright backgrounds.  Instead, OS/2 displays bright background colors, 
regardless of the BrightBG or SETDOS /B setting.  It does not provide a 
way to display blinking characters in windowed mode.  As an example, the 
two commands given above would both display white text on a bright blue 
background when run in windowed mode. 

Switching Modes 
OS/2 allows you to switch any DOS or other text-mode session between 
full-screen and windowed mode.  You cannot switch modes for OS/2 sessions, 
so CMD.EXE is not directly affected by mode switching.  However, if you 
write batch files or aliases which run in both modes, you may need to take 
into account that OS/2 defaults to displaying blinking text in full-screen 
mode and bright backgrounds in windowed mode. 

Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs