gregoiregentil gregoiregentil - 1 year ago 110
Linux Question

Minicom black background color is not respected

If I start minicom in a terminal using color with the option "-c on", black background is actually grey.

minicom -c on

If I setup any color in the settings, such as red, the background color is respected

minicom -c on -s
#Go to "Screen and keyboard", change "Background Color (term)"

But black is definitely grey. Any idea why is that?

Answer Source

Black will be "gray" on some terminals, not others, due to differences in color palettes. Minicom is using the curses support for eight ANSI colors. There is no standard for the actual colors used. "ANSI" (actually ECMA-48) only gives the names of the colors, for given numbers.

Users of both gnome-terminal and konsole have noticed that their "black" background is actually gray. Apparently their developers did this to make the terminal look nicer on the desktop; no consideration was made for actually using the terminal. xterm and rxvt use black (or white, depending on resource settings). For the former, you can usually edit your profile preferences and change the palette color assignments.

Here are sample screenshots from my Debian 7 machine to illustrate the differences you may see:

First, xterm

screenshot of xterm

then gnome-terminal

screenshot of gnome-terminal

and konsole:

screenshot of konsole

Further reading:

But that is only part of the story. Minicom was originally written to be specific to the Linux console. Those terminals can display 8 foreground and 8 background colors. But they do something interesting with the bold attribute:

  • a bold foreground color is brighter
  • a bold background also may be brighter.

The source-code isn't particularly sophisticated, and it draws colors and attributes (such as bold) assuming that they are independent of each other. It does not use ncurses. If it did, it (via ncurses) would pay attention to the ncv capability. Quoting from terminfo(5):

   no_color_video                ncv        NC        video attributes
                                                      that cannot be used 
                                                      with colors


   On  some color terminals, colors collide with highlights.  You can reg‐
   ister these collisions with the ncv capability.  This is a bit-mask  of
   attributes  not to be used when colors are enabled.  The correspondence
   with the attributes understood by curses is as follows:

                Attribute                   Bit    Decimal
                A_STANDOUT                  0     1
                A_UNDERLINE                 1     2  
                A_REVERSE                   2     4
                A_BLINK                     3     8
                A_DIM                       4     16  
                A_BOLD                      5     32
                A_INVIS                     6     64
                A_PROTECT                   7     128  
                A_ALTCHARSET                8     256

   For example, on many IBM PC consoles, the underline attribute  collides  
   with  the  foreground  color  blue  and is not available in color mode.
   These should have an ncv capability of 2.

If you use infocmp to see, the "linux" terminal description uses ncv:

linux|linux console,
        am, bce, ccc, eo, mir, msgr, xenl, xon,
        colors#8, it#8, ncv#18, pairs#64,

which is (again) part of the story (you may notice bold is not encoded in ncv here). ncurses also orders the updates to the screen to keep from accidentally making a bold background — to handle the Linux console properly.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download