]> git.eshelyaron.com Git - emacs.git/commitdiff
(frame-set-background-mode): If a tty frame defines a
authorEli Zaretskii <eliz@gnu.org>
Thu, 19 Oct 2000 06:56:50 +0000 (06:56 +0000)
committerEli Zaretskii <eliz@gnu.org>
Thu, 19 Oct 2000 06:56:50 +0000 (06:56 +0000)
background color, use that to compute the background mode, instead
of always defaulting to "dark".

lisp/ChangeLog
lisp/faces.el

index af78d5e4df3354ccfc0d198eaf6b9da56bb057a6..cdd3b0518df3111bbe7cd44218ac8f84bd9772fb 100644 (file)
@@ -1,3 +1,9 @@
+2000-10-19  Eli Zaretskii  <eliz@is.elta.co.il>
+
+       * faces.el (frame-set-background-mode): If a tty frame defines a
+       background color, use that to compute the background mode, instead
+       of always defaulting to "dark".
+
 2000-10-19  Miles Bader  <miles@lsi.nec.co.jp>
 
        * comint.el (comint-write-output): New function.
index 89c3bf73f3cdb93ea6d0a6007ecf253c17b63eb0..f4bd0eee9cea8241913c318b17aaf077d1de2467 100644 (file)
@@ -1308,22 +1308,27 @@ this won't have the expected effect."
   (let* ((bg-resource
          (and window-system
               (x-get-resource ".backgroundMode" "BackgroundMode")))
+        (bg-color (frame-parameter frame 'background-color))
         (bg-mode
          (cond (frame-background-mode)
-               ((null window-system)
-                ;; No way to determine this automatically (?).
-                'dark)
                (bg-resource
                 (intern (downcase bg-resource)))
-               ((< (apply '+ (x-color-values
-                              (frame-parameter frame 'background-color)
-                              frame))
+               ((and (null window-system) (null bg-color))
+                ;; No way to determine this automatically (?).
+                'dark)
+               ;; Unspecified frame background color can only happen
+               ;; on tty's.
+               ((memq bg-color '("unspecified" "unspecified-bg"))
+                'dark)
+               ((eq bg-color "unspecified-fg") ; inverted colors
+                'light)
+               ((>= (apply '+ (x-color-values bg-color frame))
                    ;; Just looking at the screen, colors whose
                    ;; values add up to .6 of the white total
                    ;; still look dark to me.
                    (* (apply '+ (x-color-values "white" frame)) .6))
-                'dark)
-               (t 'light)))
+                'light)
+               (t 'dark)))
         (display-type
          (cond ((null window-system)
                 (if (tty-display-color-p frame) 'color 'mono))