更改Emacs语法突出显示颜色

adu*_*dum 59 emacs syntax-highlighting colors font-lock-mode

我正在运行Emacs,在C++模式和PHP模式下编辑文件.我喜欢语法高亮作为一个概念,但默认颜色是一个讽刺.我几乎看不到其中的一些:太黑了.改变价值观的最简单方法是什么?我似乎无法在网上找到任何相关信息.我甚至不介意更改二进制文件,因为我正在编译自己的Emacs.我只想找到蓝色为#0000FF的地方,并将其更改为#AAAAFF.

set*_*eth 65

我觉得最简单的方法就是使用颜色主题.

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

但如果您不想这样做,请将光标放在有问题的文本上,然后点击M-x customize-face.它应默认为光标所在的面.

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

  • 问题是,我根本无法阅读的一种颜色(它是一种深蓝色,在黑色背景上实际上是看不见的)是我键入“Mx custom-face”时显示的任何文本!(此外,ColorTheme 链接似乎有问题) (2认同)
  • 如果`Mx custom-face`默认为`hl-line`,那是因为高亮线标记了活动线。要获得“冒犯”文本的真实面目,请执行“Mx global-hl-line-mode”以暂时禁用高亮线。 (2认同)

Ste*_* B. 26

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"))))
Run Code Online (Sandbox Code Playgroud)

...

等等

你也可以输入

`M-x customize-face RET`
Run Code Online (Sandbox Code Playgroud)

这将为您提供所有自定义设置,最终以您的.emacs结束.


Dre*_*rew 18

将光标放在要更改的面("颜色")上.命中C-u C-x =.这将告诉您哪个面在该位置,并且它将让您单击以自定义它们/它们.保存您的自定义.