根据主模式更改Emacs Mode-Line颜色 [英] Change Emacs Mode-Line color based on major-mode
本文介绍了根据主模式更改Emacs Mode-Line颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想看看有没有办法改变主模式下的模式链接前景和背景颜色,
I like to see if there is a way to change the mode-link foreground and background color base on the major-mode,
我正在考虑添加逻辑在
(add-hook 'after-change-major-mode-hook
但是,我没有所有的emacs lisp体验来做出这样的改变,这是逻辑:
But, I do not have all the emacs lisp experience to make such change. Here is the logic:
switch major-mode:
case "emacs-lisp-mode":
(set-face-foreground 'mode-line "ivory")
(set-face-background 'mode-line "DarkOrange2")
case "ruby-mode":
(set-face-foreground 'mode-line "white")
(set-face-background 'mode-line "red")
...
default:
(set-face-foreground 'mode-line "black")
(set-face-background 'mode-line "white")
end switch
非常感谢!
推荐答案
你可能想要这样的东西:
You probably want something like:
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(face-remap-add-relative
'mode-line '((:foreground "ivory" :background "DarkOrange2") mode-line))))
您可能想要使用面部重映射的模式-line-inactive
面。
You might want to use face-remap for the mode-line-inactive
face as well.
这篇关于根据主模式更改Emacs Mode-Line颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文