If you’ve paid a lot of attention to the Linux terminal window or the Windows console, you might notice that text is only available in a limited number of colors. Why do the colors look the way they do? How IBM chose to display text color on the original PC set the standard for the text color to follow.
The original 1
You can display each color by combining different amounts of pure red, green and blue light. This mix of red + green + blue (or “RGB”) is the basis for all PC colors. Let’s start with the simplest case where you could mix equal amounts of red, green and blue light. To represent this combination, an “on” or an “off” value is required for each component of “RGB”. And keep in mind that an “on” or “off” is also called a “bit” in computer terminology: 1 or 0.
In the simplest case, you could assume that each color represents one bit: red, green, and blue. If one of the “RGB” bits is 1, display the red, green, or blue light at full strength. This gives eight possible colors:
You can double the number of colors by adding an extra bit, which is how IBM defined the CGA standard. Instead of just three bits as “RGB”, CGA implemented colors as “iRGB”, where the first bit was the “intensity”. If the first bit was set to 1, the PC would display the color at full brightness. If the first bit was set to 0, it would display the color with a lower brightness.
IBM has actually implemented a modified “iRGB” model. If the “intensity” bit was 0, then every 1 in “RGB” meant that the red, green, or blue colors were set to two-thirds brightness. And if the “intensity” bit was 1, then any 1 in “RGB” meant that red, green, or blue was set to full brightness, but all zeros in “RGB” were set to a third brightness. The only exception was 0110, which received a third green (“G”) brightness, turning the “low intensity yellow” into an orange or brown color.
|0000 Black||1000 bright black|
|0001 Blue||1001 Bright blue|
|0010 Green||1010 Bright green|
|0011 cyan||1011 Clear cyan|
|0100 Red||1100 Bright red|
|0101 Magenta||1101 Bright Magenta|
|0110 Brown||1110 Yellow|
|0111 White||1111 Bright white|
With this “iRGB” model, CGA could actually display sixteen colors: eight “low intensity” colors and eight “high intensity” colors. For other technical reasons, the PC could only display the eight “low intensity” colors as background colors. But foreground text can take advantage of all sixteen colors.
Today, terminal emulators such as GNOME Terminal allow you to change the color palette. Depending on the colors you choose, you may see other colors than those shown here, but you are still limited to 16 text colors and eight background colors.