aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2005-06-29 20:55:15 +0000
committerJuri Linkov2005-06-29 20:55:15 +0000
commita4ea869cfd4da4dd49e81941be0a3e07533bc210 (patch)
tree04af40bce4c745cbb34e19a10b9ea3645e7d8993
parent16f4391084f94976fbccd6c755660960da78bad6 (diff)
downloademacs-a4ea869cfd4da4dd49e81941be0a3e07533bc210.tar.gz
emacs-a4ea869cfd4da4dd49e81941be0a3e07533bc210.zip
(default-frame-background-mode): New internal variable.
(frame-set-background-mode): Use it.
-rw-r--r--lisp/faces.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index b7d06513fd8..c28cbc5d84f 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1575,6 +1575,13 @@ this won't have the expected effect."
1575 (choice-item light) 1575 (choice-item light)
1576 (choice-item :tag "default" nil))) 1576 (choice-item :tag "default" nil)))
1577 1577
1578(defvar default-frame-background-mode nil
1579 "Internal variable for the default brightness of the background.
1580Emacs sets it automatically depending on the terminal type.
1581The value `nil' means `dark'. If Emacs runs in non-windowed
1582mode from `xterm' or a similar terminal emulator, the value is
1583`light'. On rxvt terminals, the value depends on the environment
1584variable COLORFGBG.")
1578 1585
1579(defun frame-set-background-mode (frame) 1586(defun frame-set-background-mode (frame)
1580 "Set up display-dependent faces on FRAME. 1587 "Set up display-dependent faces on FRAME.
@@ -1590,13 +1597,13 @@ according to the `background-mode' and `display-type' frame parameters."
1590 (intern (downcase bg-resource))) 1597 (intern (downcase bg-resource)))
1591 ((and (null window-system) (null bg-color)) 1598 ((and (null window-system) (null bg-color))
1592 ;; No way to determine this automatically (?). 1599 ;; No way to determine this automatically (?).
1593 'dark) 1600 (or default-frame-background-mode 'dark))
1594 ;; Unspecified frame background color can only happen 1601 ;; Unspecified frame background color can only happen
1595 ;; on tty's. 1602 ;; on tty's.
1596 ((member bg-color '(unspecified "unspecified-bg")) 1603 ((member bg-color '(unspecified "unspecified-bg"))
1597 'dark) 1604 (or default-frame-background-mode 'dark))
1598 ((equal bg-color "unspecified-fg") ; inverted colors 1605 ((equal bg-color "unspecified-fg") ; inverted colors
1599 'light) 1606 (if (eq default-frame-background-mode 'light) 'dark 'light))
1600 ((>= (apply '+ (x-color-values bg-color frame)) 1607 ((>= (apply '+ (x-color-values bg-color frame))
1601 ;; Just looking at the screen, colors whose 1608 ;; Just looking at the screen, colors whose
1602 ;; values add up to .6 of the white total 1609 ;; values add up to .6 of the white total