# HG changeset patch # User Juri Linkov # Date 1120078515 0 # Node ID 379e37eca752ca048cb9a915d10fb588a85655ec # Parent fe881431ae4f8f2ed1c6a130a6fafebde0ed8dd5 (default-frame-background-mode): New internal variable. (frame-set-background-mode): Use it. diff -r fe881431ae4f -r 379e37eca752 lisp/faces.el --- a/lisp/faces.el Wed Jun 29 13:58:00 2005 +0000 +++ b/lisp/faces.el Wed Jun 29 20:55:15 2005 +0000 @@ -1575,6 +1575,13 @@ (choice-item light) (choice-item :tag "default" nil))) +(defvar default-frame-background-mode nil + "Internal variable for the default brightness of the background. +Emacs sets it automatically depending on the terminal type. +The value `nil' means `dark'. If Emacs runs in non-windowed +mode from `xterm' or a similar terminal emulator, the value is +`light'. On rxvt terminals, the value depends on the environment +variable COLORFGBG.") (defun frame-set-background-mode (frame) "Set up display-dependent faces on FRAME. @@ -1590,13 +1597,13 @@ (intern (downcase bg-resource))) ((and (null window-system) (null bg-color)) ;; No way to determine this automatically (?). - 'dark) + (or default-frame-background-mode 'dark)) ;; Unspecified frame background color can only happen ;; on tty's. ((member bg-color '(unspecified "unspecified-bg")) - 'dark) + (or default-frame-background-mode 'dark)) ((equal bg-color "unspecified-fg") ; inverted colors - 'light) + (if (eq default-frame-background-mode 'light) 'dark 'light)) ((>= (apply '+ (x-color-values bg-color frame)) ;; Just looking at the screen, colors whose ;; values add up to .6 of the white total