From 772139c0a612889052eb8017e8ef36b926e4cd9c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 19 Oct 2000 06:56:50 +0000 Subject: [PATCH] (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". --- lisp/ChangeLog | 6 ++++++ lisp/faces.el | 21 +++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index af78d5e4df3..cdd3b0518df 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2000-10-19 Eli Zaretskii + + * 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 * comint.el (comint-write-output): New function. diff --git a/lisp/faces.el b/lisp/faces.el index 89c3bf73f3c..f4bd0eee9ce 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -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)) -- 2.39.2