Minicom黑色背景颜色不受尊重

时间:2016-07-09 01:58:55

标签: linux terminal xterm term

如果我使用带有选项" -c on"的终端在终端中启动minicom,则黑色背景实际上是灰色的。

minicom -c on

如果我在设置中设置了任何颜色,例如红色,则会尊重背景颜色

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

但黑色肯定是灰色的。知道为什么会这样吗?

1 个答案:

答案 0 :(得分:2)

由于调色板的差异,黑色在某些终端上会“灰色”,而不是其他终端。 Minicom使用curses支持八种ANSI颜色。使用的实际颜色没有标准。对于给定的数字,“ANSI”(实际上是ECMA-48)仅提供颜色的名称

gnome-terminal和konsole的用户都注意到他们的“黑色”背景实际上是灰色。显然,他们的开发人员这样做是为了让终端在桌面上显得更好;没有考虑实际使用终端。 xterm和rxvt使用黑色(或白色,具体取决于资源设置)。对于前者,您通常可以编辑配置文件首选项并更改调色板颜色分配。

以下是我的Debian 7机器的示例截图,以说明您可能会看到的差异:

首先,xterm

screenshot of xterm

然后是gnome-terminal

screenshot of gnome-terminal

和konsole:

screenshot of konsole

进一步阅读:

但这只是故事的一部分。 Minicom最初编写为特定于Linux控制台。这些终端可以显示8种前景色和8种背景色。但他们使用粗体属性做了一些有趣的事情:

  • 大胆的前景色更亮
  • 大胆的背景也可能更亮。

源代码并不是特别复杂,它会绘制颜色和属性(例如粗体),假设它们彼此独立。它不使用ncurses。如果是这样,它(通过ncurses)将注意ncv能力。引自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.

如果使用infocmp查看,“linux”终端说明使用ncv

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

这是(再次)故事的一部分(您可能会注意到粗体未在此处ncv编码)。 ncurses 命令屏幕更新,以防止意外地做出大胆的背景 - 正确处理Linux控制台。