如何获得emacs背景颜色

时间:2013-10-05 18:42:08

标签: emacs colors elisp 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))

1 个答案:

答案 0 :(得分:11)

通常,背景颜色只是(face-attribute 'default :background)

但是,如果您想要在特定位置显示背景颜色,可能会显示一个或多个面部,请使用库eyedropper.el中的函数eyedrop-background-at-point