16.12 X11 颜色

在使用 MIT X 窗口系统的 Emacs 中,您可以指定颜色。

我不喜欢默认的颜色,因此我设置了自己的颜色。

以下是我在 .emacs 文件中设置值的表达式:

;; 设置光标颜色
(set-cursor-color "white")

;; 设置鼠标颜色
(set-mouse-color "white")

;; 设置前景和背景颜色
(set-foreground-color "white")
(set-background-color "darkblue")

;;; 为 isearch 和 drag 设置高亮颜色
(set-face-foreground 'highlight "white")
(set-face-background 'highlight "blue")

(set-face-foreground 'region "cyan")
(set-face-background 'region "blue")

(set-face-foreground 'secondary-selection "skyblue")
(set-face-background 'secondary-selection "darkblue")

;; 设置日历高亮颜色
(with-eval-after-load 'calendar
  (set-face-foreground 'diary   "skyblue")
  (set-face-background 'holiday "slate blue")
  (set-face-foreground 'holiday "white"))

各种蓝色调缓解了我的眼睛,并防止我看到屏幕闪烁。

或者,我也可以在各种 X 初始化文件中设置我的规格。例如,我可以在 ~/.Xresources 文件中设置前景、背景、光标和指针(即鼠标)颜色,如下所示:

Emacs*foreground:   white
Emacs*background:   darkblue
Emacs*cursorColor:  white
Emacs*pointerColor: white

无论如何,由于它不是 Emacs 的一部分,我在 ~/.xinitrc 文件中设置了我的 X 窗口的根颜色,如下所示18

xsetroot -solid Navy -fg white &

Footnotes

(18)

我还运行更现代的窗口管理器,如 Enlightenment、Gnome 或 KDE;在这些情况下,我通常指定图像而不是纯色。