2009-07-02 70 views
50

我正在运行Emacs,在C++模式和PHP模式下编辑文件。我喜欢语法突出作为一个概念,但默认的颜色是一个滑稽。我几乎读不懂其中的一些:太黑了。什么是最简单的方法来改变他们的价值观?我似乎无法在网上找到任何关于此事的信息。我甚至不介意在编译我自己的Emacs时更改二进制文件。我只想找到它表示蓝色是#0000FF的地方,并将其更改为#AAAAFF。更改Emacs语法高亮显示颜色

回答

61

我发现它最容易使用颜色主题这种事情。

https://www.emacswiki.org/emacs/ColorThemes

但是,如果你不想这样做,将光标置于有问题的文本,打M-x customize-face。它应该默认为光标结束的面。

http://www.gnu.org/software/emacs/manual/html_node/emacs/Specific-Customization.html

+0

一个不错的[颜色主题(https://github.com/bmarcot/color-主题pomgranate爆炸)。 – Benoit 2013-01-10 14:22:38

+0

问题是,当我输入`M-x customize-face`时,我无法阅读的其中一种颜色(在黑色背景中几乎看不见的深蓝色)就是显示的任何文本! (此外,ColorTheme链接似乎有问题) – Michael 2016-08-04 18:09:32

25

2种方式 - 可以安装包的颜色主题,有很多很好的方案来选择和更容易通过做手工。该由手看起来像这样(在你的.emacs)

(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 "lightyellow2" :foreground "gray20" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight bold :width normal :family "liberation mono")))) 
    '(background "blue") 
    '(font-lock-builtin-face ((((class color) (background dark)) (:foreground "Turquoise")))) 
    '(font-lock-comment-face ((t (:foreground "MediumAquamarine")))) 
    '(font-lock-constant-face ((((class color) (background dark)) (:bold t :foreground "DarkOrchid")))) 
    '(font-lock-doc-string-face ((t (:foreground "green2")))) 
    '(font-lock-function-name-face ((t (:foreground "SkyBlue")))) 
    '(font-lock-keyword-face ((t (:bold t :foreground "CornflowerBlue")))) 
    '(font-lock-preprocessor-face ((t (:italic nil :foreground "CornFlowerBlue")))) 
    '(font-lock-reference-face ((t (:foreground "DodgerBlue")))) 
    '(font-lock-string-face ((t (:foreground "LimeGreen")))) 

...

等等,等等

您也可以键入

`M-x customize-face RET` 

,这将给你所有要设置的自定义,最终都会在您的.emacs中结束。

14

将光标放在要更改的面上(“颜色”)。命中C-u C-x =。这将告诉你哪个面孔出现在该位置,并且它会让你点击来定制它/他们。保存您的自定义设置。

2

如果你根本不关心颜色突出显示,或者上面的答案都不适合你(或者花费太多时间和精力去弄清楚),这里有一个非常简单的解决方案,它可以消除颜色共。

键入以下将摆脱颜色:

M-x global-font-lock-mode

你也可以做到这一点作为一个中间步骤,让你真正看到的一切你的屏幕尝试上述任何答案。在我的情况下,这是非常有用的,因为某些关键的文本颜色可以让我改变颜色本身几乎看不见 - 例如,M-x的提示。

如果你想改变是永久性的,你可以添加到您的.emacs文件:

(setq-default global-font-lock-mode nil)