Emacs字体锁定模式:提供自定义颜色而不是脸 [英] Emacs font lock mode: provide a custom color instead of a face
本文介绍了Emacs字体锁定模式:提供自定义颜色而不是脸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在此页面讨论字体锁定模式,提供了一个突出显示自定义模式的示例:
On this page discussing font lock mode, an example is provided which highlights a custom pattern:
(add-hook 'c-mode-hook
(lambda ()
(font-lock-add-keywords nil
'(("\\<\\(FIXME\\):" 1 font-lock-warning-face t)))))
有没有办法提供自定义颜色而不是 font-lock-warning-face
和而不用定义新的自定义面。我想要写一些东西:
Is there a way to provide a custom color instead of font-lock-warning-face
and without defining a new custom face. I want to be able to write something like:
(font-lock-add-keywords nil '(("\\<\\(FIXME\\):" 1 "Blue" t)))
或RGB颜色定义:
(font-lock-add-keywords nil '(("\\<\\(FIXME\\):" 1 "#F0F0F0" t)))
使用双引号不起作用。你知道什么将使其工作吗?
Using the double quotes doesn't work. Do you know what will make it work?
推荐答案
(font-lock-add-keywords nil '(("\\<\\(FIXME\\):" 1 '(:foreground "blue") t)))
(font-lock-add-keywords nil '(("\\<\\(FIXME\\):" 1 '(:foreground "#F0F0F0") t)))
完整的属性列表位于手册。
这篇关于Emacs字体锁定模式:提供自定义颜色而不是脸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文