Text in the Terminal only has 16 colors. This is a limitation that many users are unaware of. The color palette in Terminal is limited to the following: black, white, red, green, blue, yellow, indigo, violet. This means that you cannot use any other colors in your text.
If you’ve paid much attention to the Linux terminal window, or the Windows console, you might notice that text only comes in a limited set of colors. Why do the colors look the way they do? How IBM chose to represent text color on the original PC set the standard for text color to follow.
The original 1981 IBM Personal Computer used a monochrome display, where all text was green on plain black background. Not long after, IBM introduced the Color Graphics Adapter, or CGA, which was the first to support color. In those early days of PC history, memory was limited, so IBM squeezed the most features out of that limited data.
You can display any 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 might mix equal amounts of red, green, and blue light. Representing this combination requires either an “on” or an “off” value for each component of “RGB.” And remember that an “on” or “off” is also called a “bit” in computer terminology: 1 or 0.
In that simplest case, you might assume one bit to represent each color: red, green, and blue. If any of the “RGB” bits are 1, then display the red, green, or blue light at full intensity. This gives eight possible colors:
You can double the number of colors by adding an extra bit, and that’s 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, then the PC would display the color at full brightness. If the first bit was set to 0, then it would display the color at a lower brightness.
IBM actually implemented a modified “iRGB” model. If the “intensity” bit was 0, then any 1’s in “RGB” meant the red, green, or blue colors were set to two-thirds brightness. And if the “intensity” bit was 1, then any 1’s in “RGB” meant the red, green, or blue were set to full brightness, but any 0’s in “RGB” were set to one-third brightness. The only exception was 0110, which received a one-third green (“G”) brightness, which turned the “low intensity yellow” into an orange or brown color.
With this “iRGB” model, CGA was actually able to 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 could take advantage of all sixteen colors.
Today, terminal emulators like GNOME Terminal let you change the color palette. Depending on the colors you choose, you might see different colors than those shown here, but you’re still limited to sixteen text colors and eight background colors.