Answers:
我喜欢使用custom-theme-set-faces
重新定义主题显示特定面孔的方式,例如,
(custom-theme-set-faces
'zenburn
'(font-lock-comment-face ((t (:foreground "#DFAF8F"))))
'(font-lock-comment-delimiter-face ((t (:foreground "#DFAF8F")))))
对于的特定情况zenburn
,主题本身定义了各种颜色以及一个将变量绑定到变量名称的宏,因此您可以将上述内容编写为:
(zenburn-with-color-variables
(custom-theme-set-faces
'zenburn
`(font-lock-comment-face ((t (:foreground ,zenburn-orange))))
`(font-lock-comment-delimiter-face ((t (:foreground ,zenburn-orange))))))
.spacemacs
?
zenburn
主题加载后的某个时间对代码进行评估。
在spacemacs中,安装该层theming
,请参见https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Bthemes/theming
例如,我将以下内容插入dotspacemacs/user-init
其中.spacemacs
以调整gruvbox和solarized-light主题的背景和行号颜色:
(setq theming-modifications '(
;; requires the theming layer
(gruvbox
(default :background "#1D2021" :foreground "#fdf4c1")
(linum :background "#000000" :foreground "#878787")
(fringe :background "#000000")
(linum-relative-current-face :inherit (shadow default) :background "#3C3836" :foreground "#ff0000")
(font-lock-comment-face :slant italic)
)
(solarized-light
(linum :background "#DBCDA7" :foreground "#40371F")
(fringe :background "#DBCDA7")
(font-lock-comment-face :slant italic)
)
))
我向load-theme函数添加了建议以覆盖某些面孔-这样您就可以继续正常使用load-theme选择主题,并且它将自动应用覆盖。
(defadvice load-theme (after theme-set-overrides activate)
"Set override faces for different custom themes."
(dolist (theme-settings theme-overrides)
(let ((theme (car theme-settings))
(faces (cadr theme-settings)))
(if (member theme custom-enabled-themes)
(dolist (face faces)
(custom-theme-set-faces theme face))))))
(defcustom theme-overrides nil
"Association list of override faces to set for different custom themes.")
(defun alist-set (alist-symbol key value)
"Set VALUE of a KEY in ALIST-SYMBOL."
(set alist-symbol
(cons (list key value) (assq-delete-all key (eval alist-symbol)))))
; override some settings of the ample-flat theme
(alist-set 'theme-overrides 'ample-flat '(
(default ((t (:background "gray12" :foreground "#bdbdb3"))))
(mode-line ((t (:background "cornsilk4" :foreground "#222" :inherit 'variable-pitch))))
(outline-2 ((t (:inherit font-lock-keyword-face)))) ; blueish
(outline-3 ((t (:inherit font-lock-comment-face)))) ; brownish
(outline-4 ((t (:inherit font-lock-string-face)))) ; orangeish
(org-table ((t (:inherit fixed-pitch :height 0.7 :foreground "#887"))))
(org-formula ((t (:inherit org-table :foreground nil))))
))
它可以正常工作,并且可以很好地包含在界面中,但为您使用的每个主题创建一个函数并在加载后调用自定义主题设置界面可能是最简单的-
(defun ample-flat ()
(interactive)
(mapc #'disable-theme custom-enabled-themes) ; clear any existing themes
(load-theme 'ample-flat t)
(custom-theme-set-faces 'ample-flat
'(default ((t (:background "gray12" :foreground "#bdbdb3"))))
'(mode-line ((t (:background "cornsilk4" :foreground "#222" :inherit 'variable-pitch))))
'(outline-2 ((t (:inherit font-lock-keyword-face)))) ; blueish
'(outline-3 ((t (:inherit font-lock-comment-face)))) ; brownish
'(outline-4 ((t (:inherit font-lock-string-face)))) ; orangeish
'(org-table ((t (:inherit fixed-pitch :height 0.7 :foreground "#887"))))
'(org-formula ((t (:inherit org-table :foreground nil))))
))
(ample-flat)
我所做的编辑示例spacemacs-dark
,删除了一些我不喜欢的粗体:
;; on dotspacemacs/user-config:
;; configure spacemacs-dark theme, specifically removing bolds
(let
((func "#d75fd7")
(keyword "#4f97d7")
(type "#ce537a"))
(custom-theme-set-faces
'spacemacs-dark
`(font-lock-function-name-face ((t (:foreground ,func :inherit normal))))
`(font-lock-keyword-face ((t (:foreground ,keyword :inherit normal))))
`(font-lock-type-face ((t (:foreground ,type :inherit normal))))
)
)
color-theme.el
则可能是自定义主题。在这种情况下,请相应地编辑您的问题。请参阅颜色和自定义主题。