Why is the text in the terminal only sixteen colors

Contents

If you have paid close attention to the Linux terminal window, or the windows console, you might notice that the text only comes in a limited set of colors. Why do the colors look like this? The way IBM chose to render text color on the original PC set the standard for text color to follow.

The original IBM personal computer from 1981 used a monochrome screen, where all text was green on a plain black background. Shortly after, IBM introduced the Color Graphics Adapter, the CGA, who was the first to admit color. In those early days of PC history, memory was limited, so IBM squeezed most of the functions out of that limited data.

It can display any color by combining different amounts of red light, pure green and blue. This combination of red + verde + blue (about “RGB”) is the basis for all PC colors. Let's start with the simplest case where you can mix equal amounts of red light, green and blue. Representar esta combinación necesita un valor de “has the international standard symbol for a power button on or next to it” O “off” para cada componente de “RGB”. Y recuerde que un “has the international standard symbol for a power button on or next to it” O “off” además se denomina “bit” en la terminología informática: 1 O 0.

In that simpler case, can take care that one bit represents each color: Red, green and blue. If any of the “RGB” bits is 1, then show red light, green or blue at full intensity. This gives eight possible colors:

000 Negro
001 blue
010 verde
011 cian
100 Red
101 Magenta
110 Yellow
111 White

You can double the number of colors by adding an extra bit, and this is how IBM defined the CGA standard. En lugar de solo tres bits como “RGB”, CGA implementó colores comoiRGB”, donde el primer bit fue laintensidad”. If the first bit is set to 1, then the PC would display the color in full brightness. If the first bit were set to 0, then it would show the color with a lower brightness.

IBM en realidad implementó un modeloiRGB” modified. Si el bit deintensidad” era 0, then any 1 on “RGB” significaba que los colores rojo, green or blue were set to two-thirds brightness. Y si el bit deintensidad” era 1, then any 1 on “RGB” significaba que el rojo, green or blue was set to full brightness, but any 0 on “RGB” se configuraba en un tercio de brillo. The only exception was 0110, that received a third green glow (“G”), que convirtió elamarillo de baja intensidaden un color naranja o marrón.

0000 Negro 1000 shiny black
0001 Blue 1001 bright blue
0010 Verde 1010 Shining green
0011 Cian 1011 Bright cyan
0100 Red 1100 bright red
0101 Magenta 1101 Bright magenta
0110 Brown 1110 Yellow
0111 White 1111 Bright white

Con este modeloiRGB”, CGA was able to display sixteen colors: ocho colores debaja intensidady ocho colores dealta intensidad”. For other technical reasons, la PC solo podía mostrar los ocho colores debaja intensidadcomo colores de fondo. But the text in the foreground could take advantage of the sixteen colors.

Currently, terminal emulators like GNOME Terminal allow you to change the color palette. Depending on the colors you choose, you may see different colors than those shown here, but still limited to sixteen text colors and eight background colors.

Subscribe to our Newsletter

We will not send you SPAM mail. We hate it as much as you.