1

I'm reading the manual page terminfo and I wonder if the Linux console may use the terminal type linux-16color instead of the terminal type linux.

prompt% infocmp linux linux-16color
comparing linux to linux-16color.
comparing booleans.
comparing numbers.
colors: 8, 16.
ncv: 18, 42.
pairs: 64, 256.
comparing strings.
setab: '\E[4%p1%dm', '\E[4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m'.
setaf: '\E[3%p1%dm', '\E[3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;21%;m'.

I replaced the terminal typelinux in /etc/inittab by linux-16color but the Linux console seems to display only eight colors. I thought the terminal type linux-16color could be specified to display sixteen colors, concerning the Linux console. I have also tried to set the environment variable TERM to linux-16color without success.

Can the Linux console display sixteen colors? Can the Linux console support the terminal type linux-16color?

See Also

1
  • just trying, there's something strange with regard to \e[30m and \e[90m (when using ainsi codes). If you start a loop with 31..37 vs 91..97 (avoiding 30 and 90) you should see more than 8 colors. I have no idea what's the meaning
    – A.B
    Aug 24, 2018 at 17:16

1 Answer 1

3

The linux-16color terminal description uses the console's blink- and bold-attributes to map codes 0-15 into the 16 colors that the console is capable of doing. In the description, that is done using the 5 vs 25 and 1 vs 21 constants in the setaf and setab capabilities which you may notice in the console_codes(4) manual page.

You might find it easier to see using the -f option of infocmp:

    setab=\E[4 
            %p1%{8}%m%d 
            %? 
                    %p1%{7}%> 
                    %t;5 
            %e 
                    ;25 
            %; 
            m,

The sequence (reading top to bottom) does this:

  • sends an ASCII escape (the \E) followed by [ and 4
  • checks if the first parameter is greater than 7
    • if yes, sends ; (a delimiter) and 5 (the blink attribute)
    • if no, sends ; 2 5 to turn blink off)
  • finishes the SGR by sending m

Those attributes happen to work with VGA drivers which don't (generally) cause the text to blink, or use a different font to show bold text. Instead, they allow extending the set of colors (in a nonstandard manner, of course). If you have a different display device (such as the virtual machines I work with), none of that applies anymore.

There's a complication since that was set up: configurations which load a Unicode-capable font (i.e., 512 glyphs versus the original 256) take over one of the bits used for those 16 colors, so you really only get 8 colors. That's mentioned here and there this for example, but was introduced since the manual page was last updated:

Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous example, bright colors are no longer available on the Linux console unless a framebuffer is used. If one wants to have bright colors without framebuffer and can live without characters not belonging to his language, it is still possible to use a language-specific 256-glyph font, as illustrated below:

0

You must log in to answer this question.