changeset 32641:48709f040160

(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".
author Eli Zaretskii <eliz@gnu.org>
date Thu, 19 Oct 2000 06:55:04 +0000
parents 9adbb2160f48
children 098996fe006c
files lisp/faces.el
diffstat 1 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/faces.el	Thu Oct 19 06:55:02 2000 +0000
+++ b/lisp/faces.el	Thu Oct 19 06:55:04 2000 +0000
@@ -1308,22 +1308,27 @@
   (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)
+		(bg-resource
+		 (intern (downcase bg-resource)))
+		((and (null window-system) (null bg-color))
 		 ;; No way to determine this automatically (?).
 		 'dark)
-		(bg-resource
-		 (intern (downcase bg-resource)))
-		((< (apply '+ (x-color-values
-			       (frame-parameter frame 'background-color)
-			       frame))
+		;; 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))