Function: frame--current-background-mode

frame--current-background-mode is a byte-compiled function defined in frame.el.gz.

Signature

(frame--current-background-mode FRAME)

Aliases

frame--current-backround-mode (obsolete since 30.1)

Source Code

;; Defined in /usr/src/emacs/lisp/frame.el.gz
(defun frame--current-background-mode (frame)
  (let* ((frame-default-bg-mode (frame-terminal-default-bg-mode frame))
         (bg-color (frame-parameter frame 'background-color))
         (tty-type (tty-type frame))
         (default-bg-mode
	   (if (or (window-system frame)
		   (and tty-type
			(string-match "^\\(xterm\\|rxvt\\|dtterm\\|eterm\\)"
				      tty-type)))
	       'light
	     'dark)))
    (cond (frame-default-bg-mode)
	  ((equal bg-color "unspecified-fg") ; inverted colors
	   (if (eq default-bg-mode 'light) 'dark 'light))
	  ((not (color-values bg-color frame))
	   default-bg-mode)
	  ((color-dark-p (mapcar (lambda (c) (/ c 65535.0))
                                 (color-values bg-color frame)))
	   'dark)
	  (t 'light))))