Change Emacs syntax highlighting colors

前端 未结 4 925
天命终不由人
天命终不由人 2020-12-22 22:53

I\'m running Emacs, editing files in C++ mode and PHP mode. I love syntax highlighting as a concept, but the default colors are a travesty. I can barely read some of them: w

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-22 23:29

    2 ways - you can install the package color-theme, which has lots of nice schemes to select and is easier to do it by hand. The by-hand looks like this (in your .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"))))
    

    ...

    etc. etc.

    You can also type

    `M-x customize-face RET`
    

    which will give you all the customizations to set, ultimately end up in your .emacs.

提交回复
热议问题