0

I have added (set-background-color "blue") to my ~/.emacs (just for test purposes). When I run Emacs in windowed mode this makes the background color blue (as expected), but when I run Emacs in terminal mode in the GNOME Terminal (with or without an associated X display), the background color remains what it was when running the shell I used to start Emacs, which is black.

Why doesn't (set-background-color "blue") work when I run Emacs in the GNOME Terminal, and what must I do instead to change the background color? Is it possible to do this in Emacs or do I need to change the color scheme of the terminal?

1 Answer 1

0

You might want to review your question; it appears to have some confusion about the difference between black and blue.

You can read the documentation for set-background-color (or any other function) by typing C-h f, and entering the function name when prompted. For reference here is the help for set-background-color:

set-background-color is an interactive and byte-compiled function
defined in frame.el.gz.

Signature
(set-background-color COLOR-NAME)

Documentation
Set the background color of the selected frame to COLOR-NAME.

When called interactively, prompt for the name of the color to use.
To get the frame's current background color, use frame-parameters.

Note in particular that this function sets the background color of the currently selected frame. But during startup when your init file is run, there are no frames yet.

Instead of calling this function, you want to set the default frame parameters:

(add-to-list 'default-frame-alist '(background-color . "blue"))

See chapter 21.11 Frame Parameters of the Emacs manual for more information.

2
  • Thanks for the notification. I've fixed that error now. Jun 14 at 13:50
  • Changing to (add-to-list 'default-frame-alist '(background-color . "blue")) doesn't have any effect. The background color of Emacs is still blue when running in windowed mode but black when running in terminal mode. Jun 14 at 13:54

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.