Function: rxvt-colorfgbg-background-mode
rxvt-colorfgbg-background-mode is a byte-compiled function defined in
rxvt.el.gz.
Signature
(rxvt-colorfgbg-background-mode FGBG)
Documentation
Determine background mode.
FGBG is a string of the same meaning as the COLORFGBG environment variable.
Source Code
;; Defined in /usr/src/emacs/lisp/term/rxvt.el.gz
(defun rxvt-colorfgbg-background-mode (fgbg)
"Determine background mode.
FGBG is a string of the same meaning as the COLORFGBG environment variable."
(let (bg rgb)
(when (and fgbg
(string-match ".*;\\([0-9][0-9]?\\)\\'" fgbg))
(setq bg (string-to-number (substring fgbg (match-beginning 1))))
;; The next line assumes that rxvt-standard-colors are ordered
;; by the color index in the ascending order!
(setq rgb (car (cddr (nth bg rxvt-standard-colors))))
;; See the commentary in frame-set-background-mode about the
;; computation below.
(if (< (apply '+ rgb)
;; The following line assumes that white is the 15th
;; color in rxvt-standard-colors.
(* (apply '+ (car (cddr (nth 15 rxvt-standard-colors)))) 0.6))
'dark
'light))))