graphics.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Graphics Mode Colors
                                             Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     In VGA, MCGA, or EGA graphics mode, a color is specified by a long
     value. The default colors for indexes 0 - 15 in color text modes
     and in 16-color graphics modes have manifest constants defined for
     them in GRAPH.H. These colors are as follows:
 
     Index     Constant
 
     0         _BLACK
     1         _BLUE
     2         _GREEN
     3         _CYAN
     4         _RED
     5         _MAGENTA
     6         _BROWN
     7         _WHITE
     8         _GRAY
     9         _LIGHTBLUE
     10        _LIGHTGREEN
     11        _LIGHTCYAN
     12        _LIGHTRED
     13        _LIGHTMAGENTA
     14        _YELLOW
     15        _BRIGHTWHITE
 
     In the long value specification of a color, the lower three bytes
     represent the three component colors: red, green, and blue.
 
     The VGA and MCGA support 262,144 colors (256K), and the byte
     representing each of the component colors must be in the range
     0-31. In other words, the lower-order six bits of each byte specify
     the component's intensity and the high-order two bits should be
     zero. The fourth (high-order) byte in the long value is unused and
     should be set to 0. The diagram below shows the ordering of bytes
     within the long value:
 
          blue byte     green byte     red byte
          00BBBBBB      00GGGGGG       00RRRRRR
          high ----------------------> low order
 
     The EGA supports only 64 different colors. Color values for EGA
     are specified in exactly the same way as for the VGA. However, the
     four low-order bits of each byte are simply ignored.
 
     If a VGA or MCGA adapter is connected to an analog monochrome
     monitor, the color value is transformed into its gray-scale
     equivalent, based on the weighted sum of its red, green, and blue
     components (30% red + 50% green + 11% blue). The original red,
     green, and blue values are lost.
                                    -♦-