Video Palettes

CGA Text Mode

In color text modes, the CGA card can emit a total of 16 different colors - a combination of the four video signals: red, green, blue, and intensity - a signal that boosts the brightness of the previous three color signals. Note that the intensity bit also boosts the apparent brightness of pure black, creating a dim gray.

NOTE: The standard CGA brown color is not actually a color emitted by the CGA card; the conversion of ‘dark yellow’ to brown occurs via special circuitry within the IBM 5153 Color Display and most CGA-compatible monitors.

Full RGBI Palette

R G B I Color Hex
0000 000000
0010 0000AA
0100 00AA00
0110 00AAAA
1000 AA0000
1010 AA00AA
1100 AA5500
1110 AAAAAA
0001 555555
0011 5555FF
0101 55FF55
0111 55FFFF
1001 FF5555
1011 FF55FF
1101 FFFF55
1111 FFFFFF

The “IBM 5153” Palette

The aforementioned palette represents “ideal” colors - theoretically perfect color outputs. Modern displays have no problem rendering such colors, but original CGA monitors such as the IBM 5153 Color Display had their own eccentricities.

Taking into account the electrical characteristics of the 5153, a more visually authentic CGA palette can be derived:

R G B I Color Hex
0000 000000
0010 0000C4
0100 00C400
0110 00C4C4
1000 C40000
1010 C400C4
1100 C47E00
1110 C4C4C4
0001 4E4E4E
0011 4E4EDC
0101 4EDC4E
0111 4EF3F3
1001 DC4E4E
1011 F34EF3
1101 F3F34E
1111 FFFFFF

CGA Graphics Modes

Although much is said - derisively - about the CGA’s ugly ‘palettes’, the IBM CGA card does not actually have what we would typically consider palettes at all.

In graphics mode, pairs of bits from video memory drive the red and green video output lines directly, with no color look-ups performed. The effect of having multiple palettes is produced by miscellaneous logic that determines if and when the blue video output is additionally enabled or not.

When both bits from video memory are 0, the background/overscan color configured in the CGA Color Control register is substituted. Black is not a requirement for any of the CGA’s palettes.

The intensity bit, specified in the CGA Color Control register, provides two variations of brightness per palette.

Default Palette (Blue Disabled)

R G B I Color Hex
0000 Overscan
0100 00AA00
1000 AA0000
1100 AA5500
R G B I Color Hex
0001 Overscan
0101 55FF55
1001 FF5555
1101 FFFF55

Secondary Palette (Blue Enabled)

R G B I Color Hex
0000 Overscan
0110 00AAAA
1010 AA00AA
1110 AAAAAA
R G B I Color Hex
0001 Overscan
0111 55FFFF
1011 FF55FF
1111 FFFFFF

Alternate Palette (Blue Enabled Except When Red)

Sometimes described as a “hidden” palette, and often considered the most aesthetically pleasing, the cyan-red-white palette was only implemented to provide better contrast when displaying CGA graphics modes on a monochrome composite display, such as a black-and-white television set. It was not implemented for its aesthetics, and thus IBM probably didn’t see fit to document it as a color option - after all, later revisions of the CGA could have always disabled the need for it by adjustments to the composite output circuitry.

This palette is created by miscellaneous logic that enables the blue video output unless the color red is decoded.

R G B I Color Hex
0000 Overscan
0110 00AAAA
1000 AA0000
1110 AAAAAA
R G B I Color Hex
0001 Overscan
0111 55FFFF
1001 FF5555
1111 FFFFFF

EGA 6-bit Palette (64 Colors)

The EGA can display any 16 of these 64 colors simultaneously when connected to an EGA monitor and operating in 350 line mode, although there are exceptions that enable use of 6bpp color in 200 line modes with the right hardware.

IndexRIGIBIRGBColorHex IndexRIGIBIRGBColorHex
00000000 00000020100000 550000
01000001 0000AA21100001 5500AA
02000010 00AA0022100010 55AA00
03000011 00AAAA23100011 55AAAA
04000100 AA000024100100 FF0000
05000101 AA00AA25100101 FF00AA
06000110 AAAA0026100110 FFAA00
07000111 AAAAAA27100111 FFAAAA
08001000 00005528101000 550055
09001001 0000FF29101001 5500FF
0A001010 00AA552A101010 55AA55
0B001011 00AAFF2B101011 55AAFF
0C001100 AA00552C101100 FF0055
0D001101 AA00FF2D101101 FF00FF
0E001110 AAAA552E101110 FFAA55
0F001111 AAAAFF2F101111 FFAAFF
10010000 00550030110000 555500
11010001 0055AA31110001 5555AA
12010010 00FF0032110010 55FF00
13010011 00FFAA33110011 55FFAA
14010100 AA550034110100 FF5500
15010101 AA55AA35110101 FF55AA
16010110 AAFF0036110110 FFFF00
17010111 AAFFAA37110111 FFFFAA
18011000 00555538111000 555555
19011001 0055FF39111001 5555FF
1A011010 00FF553A111010 55FF55
1B011011 00FFFF3B111011 55FFFF
1C011100 AA55553C111100 FF5555
1D011101 AA55FF3D111101 FF55FF
1E011110 AAFF553E111110 FFFF55
1F011111 AAFFFF3F111111 FFFFFF

The Default VGA Palette

The VGA has a total palette of 256 out of 262,144 colors, making a full table a bit impractical. The default VGA palette is shown below.

The VGA still has the 16 Attribute Controller Palette registers, which are used in text mode and 4bpp modes, however they no longer store color information. Instead, they contain indexes into the 256 color registers of the DAC. This DAC lookup is always active.

The first 16 colors of the default VGA palette correspond to the traditional 16 color RGBI palette, and so the Attribute Palette registers reference the same colors by virtue of being initialized with the values 0-F. The Attribute Palette registers remain 6 bits, and so they can only reference a total of 64 DAC Color registers. Due to this, the VGA divides the 256 total Color registers into four separate banks, which can be selected independently.

0000000000AA00AA0000AAAAAA0000AA00AAAA5500AAAAAA5555555555FF55FF5555FFFFFF5555FF55FFFFFF55FFFFFF
0000001414142020202C2C2C383838454545515151616161717171828282929292A2A2A2B6B6B6CBCBCBE3E3E3FFFFFF
0000FF4100FF7D00FFBE00FFFF00FFFF00BEFF007DFF0041FF0000FF4100FF7D00FFBE00FFFF00BEFF007DFF0041FF00
00FF0000FF4100FF7D00FFBE00FFFF00BEFF007DFF0041FF7D7DFF9E7DFFBE7DFFDF7DFFFF7DFFFF7DDFFF7DBEFF7D9E
FF7D7DFF9E7DFFBE7DFFDF7DFFFF7DDFFF7DBEFF7D9EFF7D7DFF7D7DFF9E7DFFBE7DFFDF7DFFFF7DDFFF7DBEFF7D9EFF
B6B6FFC7B6FFDBB6FFEBB6FFFFB6FFFFB6EBFFB6DBFFB6C7FFB6B6FFC7B6FFDBB6FFEBB6FFFFB6EBFFB6DBFFB6C7FFB6
B6FFB6B6FFC7B6FFDBB6FFEBB6FFFFB6EBFFB6DBFFB6C7FF0000711C007138007155007171007171005571003871001C
710000711C007138007155007171005571003871001C710000710000711C007138007155007171005571003871001C71
383871453871553871613871713871713861713855713845713838714538715538716138717138617138557138457138
387138387145387155387161387171386171385571384571515171595171615171695171715171715169715161715159
715151715951716151716951717151697151617151597151517151517159517161517169517171516971516171515971
000041100041200041300041410041410030410020410010410000411000412000413000414100304100204100104100
004100004110004120004130004141003041002041001041202041282041302041382041412041412038412030412028
412020412820413020413820414120384120304120284120204120204128204130204138204141203841203041202841
2C2C41302C41342C413C2C41412C41412C3C412C34412C30412C2C41302C41342C413C2C41412C3C412C34412C30412C
2C412C2C41302C41342C413C2C41412C3C412C34412C3041000000000000000000000000000000000000000000000000

Primary Emulation Resources