GNU Emacs 32.0.50 (9008bf64c3) のマニュアルを PLaMo 翻訳で機械翻訳したものです。誤訳を含むことがあります。原文: https://www.gnu.org/software/emacs/manual/html_node/eintr/X11-Colors.html ・ emacs-doc.conao3.com

16.12 X11 カラー

MIT X WindowingシステムでEmacsを使用する際は、色を指定できます。

デフォルトの色が気に入らないので、自分で指定します。

私の.emacsファイル内で値を設定している式は以下の通りです:

;; Set cursor color
(set-cursor-color "white")

;; Set mouse color
(set-mouse-color "white")

;; Set foreground and background
(set-foreground-color "white")
(set-background-color "darkblue")

;;; Set highlighting colors for isearch and 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")

;; Set calendar highlighting colors
(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ウィンドウのルート色を設定しています22:

xsetroot -solid Navy -fg white &

脚注

(22)

EnlightenmentやGnome、KDEといったよりモダンなウィンドウマネージャも動かしていますが、その場合は単色ではなく画像を指定することが多いです。