xterm-color & 和有什么不一样?xterm-256color? [英] What is the difference between xterm-color & xterm-256color?
问题描述
我在尝试设置我的终端程序以使用颜色时遇到了 xterm-color
和 xterm-256color
作为选项 - 即你可以设置你的 TERM
环境变量之一.
I've come across both xterm-color
and xterm-256color
as options when trying to set up my terminal program to use color - i.e. you can set your TERM
environment variable to either one.
我想知道是否有人可以描述两者之间的区别?
I was wondering if anyone can describe the difference between the two?
我在我的 Ubuntu 服务器和 Mac 上搜索过文档,但没有找到.我只能在 /usr/share/terminfo
中找到各种二进制文件.
I've searched for documentation on my Ubuntu server as well as my mac but haven't found any. I've only been able to find various binary files in /usr/share/terminfo
.
推荐答案
xterm-256color
描述启用了 256 色支持的 Xterm.xterm-color
描述了 Xterm 的一个旧分支,它支持八种颜色.不推荐使用 xterm-color
,因为它描述了一个功能较少的 Xterm 变体,您不太可能使用它.通常你会想要使用 xterm
、xterm-16color
或 xterm-256color
.
xterm-256color
describes Xterm with support for 256 colors enabled. xterm-color
describes an older branch of Xterm that supports eight colors. xterm-color
is not recommended, since it describes a variant of Xterm that’s less functional and that you’re not likely to be using. Usually you’ll want to use xterm
, xterm-16color
or xterm-256color
.
特别是,xterm-256color
是从 Mac OS X 10.7 Lion 开始的终端的默认值,次佳推荐值是 xterm-16color
或 xterm
(仅描述了对八种 ANSI 颜色的支持).在 10.7 之前,xterm-color
是默认值,因为终端不支持推荐的 Xterm terminfo 值描述的一些关键功能,例如,背景颜色擦除 (BCE),用于切换主/备用的现代代码屏幕,256 色.
In particular, xterm-256color
is the default for Terminal starting with Mac OS X 10.7 Lion, with the next-best recommended values being xterm-16color
or xterm
(which only describes support for eight ANSI colors). Prior to 10.7, xterm-color
was the default because Terminal didn’t support some critical features described by the recommended Xterm terminfo values, e.g., Background Color Erase (BCE), modern codes for switching main/alternate screens, 256 colors.
有时人们会明确地将 TERM
设置为 xterm-color
(与推荐的 Xterm 值相反)以禁用功能或解决特定项目上可用 terminfo 值之间的不兼容性计算机和正在使用的终端模拟器.
Sometimes people explicitly set TERM
to xterm-color
(as opposed to the recommended Xterm values) to disable functionality or work around incompatibilities between the available terminfo values on a particular computer and the terminal emulator being used.
请注意,从技术上讲,Terminal 应该有自己的最新 terminfo 值来准确描述它支持哪些功能,而不是使用 Xterm 的值,但是:
Note that technically Terminal should have its own up-to-date terminfo values that describe exactly which features it supports, instead of using the values for Xterm, but:
- 目前没有一个是最新的.
nsterm
代表来自 NeXTSTEP 的 Terminal 的祖先.显然有人最近(过去几年的某个时间)更新了nsterm
,但我不知道这是否已进入 ncurses 发行版,并且它可能不完全是最新的10.7 中的终端. - 许多程序和外壳定制脚本明确检查
$TERM
是否以(或等于)xterm
开头.因此,一些用户仍需要了解将推荐的 Xterm 值与终端一起使用以与这些值兼容.
- There isn’t one that’s up to date currently.
nsterm
represents Terminal’s ancestor from NeXTSTEP. Someone apparently has updatednsterm
recently (sometime in the past couple of years), but I don’t know whether that has made its way into the ncurses distribution, and it may not be completely up to date with Terminal in 10.7. - A number of programs and shell customization scripts explicitly check whether
$TERM
starts with (or is equal to)xterm
. So some users would still need to know about using the recommended Xterm values with Terminal for compatibility with those.
如果您不熟悉 terminfo 系统,请查看 x-man-page://5/terminfo 手册页.此外,您还可以使用 infocmp
命令查看当前的 terminfo 设置或比较两个不同的设置,例如,infocmp xterm-color xterm-256color
将向您显示两者之间的所有差异那两个.
If you’re not familiar with the terminfo system, take a look at the x-man-page://5/terminfo man page. Also, you can use the infocmp
command to view the current terminfo settings or compare two different ones, e.g., infocmp xterm-color xterm-256color
will show you all the differences between those two.
这篇关于xterm-color & 和有什么不一样?xterm-256color?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!