use*_*669 4 emacs elisp colors background-color
具体来说,我试图使下面的代码工作:问题是term-default-bg-color(接近代码块的末尾)似乎并不普遍存在所以我试图获得emacs背景颜色并使用它
(defun low-lock-face-phrase-buffer (regexp )
"Set face of each match of phrase REGEXP to term-default-bg-color to dim it;
internally it calls to hi-lock-face-phrase-buffer"
(interactive
(list
(hi-lock-regexp-okay
(hi-lock-process-phrase
(read-regexp "Phrase to dim" (car regexp-history))))))
(unless hi-lock-mode (hi-lock-mode 1))
(hi-lock-set-pattern regexp 'term-default-bg-color))
Run Code Online (Sandbox Code Playgroud)
Dre*_*rew 11
一般来说,背景颜色只是(face-attribute 'default :background).
但是,如果您想要在特定位置显示背景颜色,可能会显示一个或多个面,则使用eyedrop-background-at-point库中的函数eyedropper.el.