Why Textual content in The Terminal Solely Has Sixteen Colours – CloudSavvy IT

Posted on

In case you’ve paid a lot consideration to the Linux terminal window, or the Home windows console, you may discover that textual content solely is available in a restricted set of colours. Why do the colours look the best way they do? How IBM selected to symbolize textual content coloration on the unique PC set the usual for textual content coloration to comply with.

The unique 1981 IBM Private Pc used a monochrome show, the place all textual content was inexperienced on plain black background. Not lengthy after, IBM launched the Colour Graphics Adapter, or CGA, which was the primary to assist coloration. In these early days of PC historical past, reminiscence was restricted, so IBM squeezed essentially the most options out of that restricted information.

You’ll be able to show any coloration by combining totally different quantities of pure purple, inexperienced, and blue mild. This mixture of Crimson+Inexperienced+Blue (or “RGB”) is the premise for all PC colours. Let’s begin with the best case the place you may combine equal quantities of purple, inexperienced, and blue mild. Representing this mixture requires both an “on” or an “off” worth for every element of “RGB.” And keep in mind that an “on” or “off” can be known as a “bit” in pc terminology: 1 or 0.

In that easiest case, you may assume one bit to symbolize every coloration: purple, inexperienced, and blue. If any of the “RGB” bits are 1, then show the purple, inexperienced, or blue mild at full depth. This provides eight doable colours:

000 Black
001 Blue
010 Inexperienced
011 Cyan
100 Crimson
101 Magenta
110 Yellow
111 White

You’ll be able to double the variety of colours by including an additional bit, and that’s how IBM outlined the CGA commonplace. As a substitute of simply three bits as “RGB,” CGA applied colours as “iRGB,” the place the primary bit was the “depth.” If the primary bit was set to 1, then the PC would show the colour at full brightness. If the primary bit was set to 0, then it will show the colour at a decrease brightness.

IBM truly applied a modified “iRGB” mannequin. If the “depth” bit was 0, then any 1’s in “RGB” meant the purple, inexperienced, or blue colours have been set to two-thirds brightness. And if the “depth” bit was 1, then any 1’s in “RGB” meant the purple, inexperienced, or blue have been set to full brightness, however any 0’s in “RGB” have been set to one-third brightness. The one exception was 0110, which obtained a one-third inexperienced (“G”) brightness, which turned the “low depth yellow” into an orange or brown coloration.

0000 Black1000 Brilliant Black
0001 Blue1001 Brilliant Blue
0010 Inexperienced1010 Brilliant Inexperienced
0011 Cyan1011 Brilliant Cyan
0100 Crimson1100 Brilliant Crimson
0101 Magenta1101 Brilliant Magenta
0110 Brown1110 Yellow
0111 White1111 Brilliant White

With this “iRGB” mannequin, CGA was truly in a position to show sixteen colours: eight “low depth” colours and eight “excessive depth” colours. For different technical causes, the PC may solely show the eight “low depth” colours as background colours. However foreground textual content may benefit from all sixteen colours.

As we speak, terminal emulators like GNOME Terminal allow you to change the colour palette. Relying on the colours you select, you may see totally different colours than these proven right here, however you’re nonetheless restricted to sixteen textual content colours and eight background colours.

Source link

Gravatar Image
I love to share everything with you

Leave a Reply

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