0

How can I set a different color if I am using emacs on terminal (emacs --no-window)?

I use a grey highlight line when using emacs with GUI because my background theme is white. Here is the code I use in my ~/.emacs.

(global-hl-line-mode +1)                                                                                                                      
(set-face-attribute 'hl-line nil :inherit nil :background "#e6ffff")

However, when I am using emacs on terminal it has a default black background and this highlight colour looks awful.

1

You detect your window sytem with window-system. See this question.

In terminal mode this variable is nil, so you can change the face in this case.

(when (not window-system)
    (set-face-attribute 'hl-line nil :inherit nil :background "#888888"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.