Linux 上的 Emacs/xterm 颜色烦恼
我在本地 Linux 机器和远程集群的登录节点上的控制台窗口中使用 emacs。 我经常使用 emacs,并且在 .emacs 文件中将前景色设置为白色,如下所示:
(set-foreground-color "white")
(set-background-color "black")
但是,当我运行 emacs 时,前景色不是白色;它是白色的。 它是灰色的,很难阅读。 在我的 Mac 上,具有相同设置的控制台窗口中的 emacs 显示为正确的白色。 但在 konsole 和 xterm 的两个 Linux 机器上,它都是灰色的。
以防万一,我已将 TERM
设置为 xterm-color,桌面运行 RHEL 5,集群节点运行 RHEL 4 (CentOS)。
这是 Linux 设置终端颜色的默认方式吗? 怎样才能变白变白呢?
注意:这是控制台 emacs,而不是 X 下的 emacs。如果您设置了 DISPLAY
,则为 emacs -nw
。
I'm using emacs in a console window both on my local Linux box and on the login node of a remote cluster. I use emacs regularly, and I've got the foreground color set to white in my .emacs file like so:
(set-foreground-color "white")
(set-background-color "black")
However, when I run emacs, the foreground isn't white; it's grey and very hard to read. On my Mac, emacs in a console window with the same settings shows up as proper white. But on both linux boxes, in konsole and xterm, it's grey.
In case it matters, I've got TERM
set to xterm-color, the desktop is running RHEL 5, and the cluster node is running RHEL 4 (CentOS).
Is this some default with how Linux sets up terminal colors? How do I get white to be white?
Note: this is with console emacs, not emacs under X. That's emacs -nw
if you have DISPLAY
set.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
颜色
brightwhite
在我的 Emacs 上看起来不错(它在终端下运行,而不是 X)。 在 RHEL5 上,我将TERM
环境变量设置为xterm-256color
。 如果工作正常,您应该能够运行这些脚本并看到 256 色输出。 在 Emacs 下,当您执行Mx list-colors-display
时,您应该会看到相当平滑的色带(没有明显重复的颜色)。 如果没有,您可能缺少正确的 termcap 条目(我认为尝试安装 libtermcap-devel 包)。如果我将
TERM
更改为xterm-color
,则brightwhite
在list-colors-display< 的输出中会显得有点灰色/代码>。
我不确定 RHEL4 的情况。
The color
brightwhite
looks ok on my Emacs (which is running under a terminal, not X). On RHEL5 I have myTERM
environment variable set toxterm-256color
. If it's working correctly, you should be able to run these scripts and see 256-color output. Under Emacs, you should see a reasonably smooth color ramp (no obviously duplicated colors) when you doM-x list-colors-display
. If not, you are probably missing the right termcap entry (try installing thelibtermcap-devel
package, I think).If I change
TERM
toxterm-color
, thenbrightwhite
comes out a bit gray in the output oflist-colors-display
.I'm not sure about RHEL4.
怎么样:
响应评论:
在 emacs 中,运行
Mx list-colors-display
,它应该显示 emacs 认为您的终端可用的所有颜色。What about:
In response to comment:
Within emacs, run
M-x list-colors-display
which should show you all of the colors that emacs thinks are available with your terminal.我做了一些实验,你可以在 emacs 中设置控制台颜色,但你仅限于这个调色板:
你得到的白色有点变灰; 全亮白色保留给粗体文本。 因此,如果您运行,
您将获得粗体(亮白色)文本以供以后插入。
我没有运气尝试将默认字体强制为粗体。
(我不太明白 emacs 中的面孔是如何工作的。)
I did some experiments, and you can set console colors in emacs, but you are limited to this palette:
The white that you get is somewhat grayed out; full bright white is reserved for bold text. So if you run
you will get bold (bright white) text for later insertions.
I had no luck trying to force the default face to bold.
(I don't really understand how faces work in emacs.)
如果您只在控制台版本中使用反向视频,就足够了吗?
What if you just used reverse-video for the console version is that good enough?
看起来您只设置了前景色。
我确定您指的是后者的
set-background-color
。可以在运行 Emacs 时确认这一点:
我也
Looks like you're only setting the foreground color.
I'm sure you meant
set-background-color
on the latter.I can confirm this when running Emacs as:
too.
我还发现我在终端模式下有奇怪的颜色,最后将其追溯到字体自定义。 我有这样的事情:
我删除了前景和背景属性,一切都开始看起来很美好。
I also found that I had weird colors in terminal mode and finally traced it down to a font face customization. I had something like this:
I removed the foreground and background properties and everything started looking hunky-dory.