Technology

#Why Text in The Terminal Only Has Sixteen Colors – CloudSavvy IT

“#Why Text in The Terminal Only Has Sixteen Colors – CloudSavvy IT”

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:

000 Black
001 Blue
010 Green
011 Cyan
100 Red
101 Magenta
110 Yellow
111 White

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.

0000 Black 1000 Bright Black
0001 Blue 1001 Bright Blue
0010 Green 1010 Bright Green
0011 Cyan 1011 Bright 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 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.

If you liked the article, do not forget to share it with your friends. Follow us on Google News too, click on the star and choose us from your favorites.

For forums sites go to Forum.BuradaBiliyorum.Com

If you want to read more like this article, you can visit our Technology category.

Source

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button
Close

Please allow ads on our site

Please consider supporting us by disabling your ad blocker!