emacs - 在 Emacs : Only change the background color 中自定义高亮面

标签 emacs emacs-faces

有什么方法可以在 Emacs 中定义人脸(例如突出显示,例如 hl-line ),以便它只更改背景颜色(并且让 Emacs 使用前景色,就好像单词没有突出显示一样)。
更具体地说,我在 tango-dark 上尝试了以下操作主题

(custom-set-faces
 '(region ((t (:inherit nil :background "RoyalBlue4"))))
 '(highlight ((t (:inherit region :background "dark olive green"))))
 '(hl-line ((t (:inherit highlight)))))
并且,如下所示,区域突出显示 尊重前景字体(即它只改变背景颜色):
enter image description here
但是 当前行的突出显示不会:
enter image description here
为什么?以及如何使用 hl-line 获得相同的效果?
更新:
这似乎是 tango-dark 中的一个错误主题(Emacs 的内置主题)。该代码适用于默认主题(加载 emacs -Q )。我将此发布在官方错误邮件列表中。

最佳答案

前段时间纠结这个,好像是颜色主题的bug。

不过,我想出了一个解决方法。这对我有用:

(load-theme 'tango-dark t)
(set-face-attribute 'highlight nil :foreground 'unspecified)

关于emacs - 在 Emacs : Only change the background color 中自定义高亮面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15733873/

相关文章:

python - Emacs:使用 pdbtrack (python.el)

emacs - 运行 hasktags 获取大量 .hs 源文件以获取 CTAGS 文件(普通 Windows)

emacsclient 无法加载颜色 "unspecified-bg"

emacs - 在 Emacs 中,如何创建将某个颜色常量映射到另一种颜色?

emacs - 在 Emacs 中哪里输入一段代码?

emacs - 在 Emacs 21.3.1 中以 C/C++ 模式更改 #if 0 ... #endif block 中代码的颜色

emacs - 在 Emacs 中添加几个函数作为钩子(Hook)

c - 如何同时交换或替换代码中的多个字符串?

emacs - 如何将参数传递给 Elisp 函数?

emacs - 让 Emacs 识别自定义数学定界符,以便它可以相应地为面部着色