centaur-tabs-mode で黒系のアイコンの例は ".emacs" の nf-oct-gear だが、これはdark系カラーテーマ(例えばdoom-dracula)のときには見えづらい。 ほか、term-modeの nf-dev-terminal などもそうであり、結局これらにはfaceが付与されていないのである (nerd-icons.el)。
そこで centaur-tabs-icon
を再定義した。
(defun centaur-tabs-icon (tab face selected) "Generate icon for TAB using FACE's background. If icon gray out option enabled, gray out icon if not SELECTED." (if centaur-tabs-icon-type (with-current-buffer (car tab) (let* ((icon (or (ignore-errors (centaur-tabs--icon-for-file (file-name-nondirectory (buffer-file-name)) :v-adjust centaur-tabs-icon-v-adjust :height centaur-tabs-icon-scale-factor)) (ignore-errors (centaur-tabs--icon-for-mode major-mode :v-adjust centaur-tabs-icon-v-adjust :height centaur-tabs-icon-scale-factor)))) (background (face-background face nil 'default)) (inactive (cond ((and (not selected) (eq centaur-tabs-gray-out-icons 'buffer)) (face-foreground 'mode-line-inactive nil 'default)) ((or centaur-tabs-plain-icons (ignore-errors ;; for .emacs (eq (string-match "^\\." (file-name-nondirectory (buffer-file-name))) 0)) (derived-mode-p 'term-mode)) (face-foreground 'centaur-tabs-selected nil 'default)) (t 'unspecified))) (underline (and (eq (if (display-graphic-p) centaur-tabs-set-bar) 'under) (face-attribute face :underline))) (overline (and (eq (if (display-graphic-p) centaur-tabs-set-bar) 'over) (face-attribute face :overline)))) (if (stringp icon) (progn (propertize icon 'face `(:inherit ,(get-text-property 0 'face icon) :foreground ,inactive :background ,background :underline ,underline :overline ,overline))) ""))) ""))