Linux 上的 Emacs/xterm 颜色烦恼

发布于 2024-07-15 04:12:19 字数 565 浏览 12 评论 0原文

我在本地 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

国粹 2024-07-22 04:12:19

颜色 brightwhite 在我的 Emacs 上看起来不错(它在终端下运行,而不是 X)。 在 RHEL5 上,我将 TERM 环境变量设置为 xterm-256color。 如果工作正常,您应该能够运行这些脚本并看到 256 色输出。 在 Emacs 下,当您执行 Mx list-colors-display 时,您应该会看到相当平滑的色带(没有明显重复的颜色)。 如果没有,您可能缺少正确的 termcap 条目(我认为尝试安装 libtermcap-devel 包)。

如果我将 TERM 更改为 xterm-color,则 brightwhitelist-colors-display< 的输出中会显得有点灰色/代码>。

我不确定 RHEL4 的情况。

The color brightwhite looks ok on my Emacs (which is running under a terminal, not X). On RHEL5 I have my TERM environment variable set to xterm-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 do M-x list-colors-display. If not, you are probably missing the right termcap entry (try installing the libtermcap-devel package, I think).

If I change TERM to xterm-color, then brightwhite comes out a bit gray in the output of list-colors-display.

I'm not sure about RHEL4.

孤寂小茶 2024-07-22 04:12:19

怎么样:

(set-foreground-color "brightwhite")

响应评论:

在 emacs 中,运行 Mx list-colors-display ,它应该显示 emacs 认为您的终端可用的所有颜色。

What about:

(set-foreground-color "brightwhite")

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.

因为看清所以看轻 2024-07-22 04:12:19

我做了一些实验,你可以在 emacs 中设置控制台颜色,但你仅限于这个调色板:

black                    blue                                         
cyan                     green                                        
magenta                  red                                          
white                    yellow    

你得到的白色有点变灰; 全亮白色保留给粗体文本。 因此,如果您运行,

M-x facemenu-set-bold

您将获得粗体(亮白色)文本以供以后插入。

我没有运气尝试将默认字体强制为粗体。
(我不太明白 emacs 中的面孔是如何工作的。)

I did some experiments, and you can set console colors in emacs, but you are limited to this palette:

black                    blue                                         
cyan                     green                                        
magenta                  red                                          
white                    yellow    

The white that you get is somewhat grayed out; full bright white is reserved for bold text. So if you run

M-x facemenu-set-bold

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.)

美煞众生 2024-07-22 04:12:19

如果您只在控制台版本中使用反向视频,就足够了吗?

$ emacs -nw -rv

What if you just used reverse-video for the console version is that good enough?

$ emacs -nw -rv
晨敛清荷 2024-07-22 04:12:19

看起来您只设置了前景色。

(set-foreground-color "white")
(set-foreground-color "black")

我确定您指的是后者的 set-background-color

可以在运行 Emacs 时确认这一点:

$ emacs -nw -bg black -fg white

我也

Looks like you're only setting the foreground color.

(set-foreground-color "white")
(set-foreground-color "black")

I'm sure you meant set-background-color on the latter.

I can confirm this when running Emacs as:

$ emacs -nw -bg black -fg white

too.

怀中猫帐中妖 2024-07-22 04:12:19

我还发现我在终端模式下有奇怪的颜色,最后将其追溯到字体自定义。 我有这样的事情:

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :background "#000a00" :foreground "#ffffed" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 113 :width normal :foundry "unknown" :family "Droid Sans Mono")))))

我删除了前景和背景属性,一切都开始看起来很美好。

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:

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :background "#000a00" :foreground "#ffffed" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 113 :width normal :foundry "unknown" :family "Droid Sans Mono")))))

I removed the foreground and background properties and everything started looking hunky-dory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文