不尊重 Minicom 黑色背景色 [英] Minicom black background color is not respected

查看:41
本文介绍了不尊重 Minicom 黑色背景色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

推荐答案

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

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.

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

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.

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

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

首先,xterm

然后是gnome终端

和控制台:

进一步阅读:

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

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:

  • 大胆的前景色更亮
  • 粗体背景也可能更亮.

源代码不是特别复杂,它绘制颜色和属性(例如粗体),假设它们彼此独立.它不使用 ncurses.如果是这样,它(通过 ncurses)会注意 ncv 功能.引自 terminfo(5):

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.

如果使用infocmp查看,linux"终端描述使用ncv:

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,

这是(再次)故事的一部分(您可能会注意到这里的 ncv 中没有对粗体进行编码).ncurses 命令更新屏幕以避免意外地制作粗体背景—正确处理 Linux 控制台.

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.

这篇关于不尊重 Minicom 黑色背景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆