Function: 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.

Probably introduced at or before Emacs version 19.29.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/frame.el.gz
(defun set-background-color (color-name)
  "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'."
  (interactive (list (read-color "Background color: ")))
  (modify-frame-parameters (selected-frame)
			   (list (cons 'background-color color-name)))
  (or window-system
      (face-set-after-frame-default (selected-frame)
				    (list
				     (cons 'background-color color-name)
				     ;; Pass the foreground-color as
				     ;; well, if defined, to avoid
				     ;; losing it when faces are reset
				     ;; to their defaults.
				     (assq 'foreground-color
					   (frame-parameters))))))