モード ラインの一部を異なる色で表示したいのですが、期待どおりに動作せず、適切な Web リファレンスが見つかりません。テキストを太字または斜体に変更できますが、必要に応じて色を変更することはできません。
最も単純な例は、単純なモード ラインをデフォルトのフェイス カラーではなく白でbuffer-file-nameで表示することです。
(custom-set-variables
'(mode-line-format
(quote
("%e" mode-line-front-space
"[" mode-name "] %l:%i"
"\t"
propertize buffer-file-name 'font-lock-face '(:foreground "white")))))
私が試したことの他の例を含めるべきだったことを指摘してくれたlegosicaに感謝します...
「font-lock-face」を「face:」に置き換えます。
propertize buffer-file-name 'face '(:foreground "white")))))
ファローアップ
TacticalCoder のおかげで、モードラインで複数のフォントと色を使用できるようになりました。'face '(:foreground "white")
設定が機能しなかった 理由は、'(:eval ...) でラップする必要があったためです。
私はこれで終わった...
(setq-default mode-line-format
(list
mode-line-front-space ; +-- just like in the default mode-line-format
'(:eval (propertize (concat "\t[" mode-name "] %l:%i\t") 'face '(:foreground "black" :height 0.9 :weight normal)
'help-echo (buffer-file-name)))
'(:eval (propertize (file-name-directory buffer-file-name) 'face 'info-title-4
'help-echo (buffer-file-name)))
'(:eval (propertize (file-name-nondirectory buffer-file-name) 'face 'info-title-3
'help-echo (buffer-file-name)))
))
と組み合わせ ...
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(info-title-3 ((t (:inherit info-title-4 :foreground "white" :height 1.2))))
'(info-title-4 ((t (:inherit info-title-4 :foreground "black"))))
'(mode-line ((t (:background "#6483af" :foreground "#001122" :box (:line-width 3 :color "#6483af") :weight ultra-bold :height 118 :family "Monospace")))))
...私が望むもののほとんどを示す素敵でシンプルなモードラインを取得します。やるべきことはまだありますが、TacticalCoder のおかげで軌道に乗っています。