By default font-lock-variable-name-face is defined as follows:
'(font-lock-variable-name-face ((t (:foreground "black" :weight bold))))
Would it be possible to change its color for different modes such as for shell-mode:
I have tried the following, which did not have any effect:
(add-hook 'shell-mode-hook
(lambda ()
'(font-lock-variable-name-face ((t (:foreground "LightGoldenrod" :weight bold))))))
dracula-theme.el is located under ~/.emacs.d/themes: https://github.com/dracula/emacs/blob/master/dracula-theme.el
minimal.el:
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(load-theme 'dracula t)
(defun my-shell-mode-faces ()
(face-remap-add-relative 'font-lock-variable-name-face '(:foreground "LightGoldenrod" :weight bold)))
(add-hook 'shell-mode-hook 'my-shell-mode-faces)
shell-modebuffer with thefont-lock-variable-name-face? I tried a few things likemake,ls,grep, andviof a few different files -- but none of those produce output with thefont-lock-variable-name-face. – lawlist Aug 02 '21 at 15:06shlike:test.sh. Its just aShell-scriptfile. Example file can contain something like: `#!/bin/bashRED="\033[1;31m"
– alper Aug 02 '21 at 15:42whereREDshould be inLightGoldenrod ` colortest.sh, with the first line being#!/bin/bash RED="\033[1;31m"STEP #2: Open the filetest.shand place the cursor on the wordREDin the first line and typeC-u C-x =and a*Help*buffer pops up telling us that this isfont-lock-comment-face. STEP #3: From the buffer containing thetest.shfile, typeC-h m, which is also known asM-x describe-mode-- this opens a*Help*buffer that tells us this is shell-script mode defined insh-script.el-- follow the link forsh-script.elin the*Help*buffer .... – lawlist Aug 02 '21 at 16:08sh-mode. Based thereon, we conclude that the major-mode hook we are interested in issh-mode-hook. CONCLUSION: From steps 1 to 3 above, we learned that the face isfont-lock-comment-faceand the major-mode hook issh-mode-hook. Therefore, adjust the example in the answer below accordingly to suit your own needs using the relevant face and the relevant hook. – lawlist Aug 02 '21 at 16:10