# HG changeset patch # User Eli Zaretskii # Date 949491405 0 # Node ID 4a4f7f602836851ca8c184dea1550c428d570f80 # Parent 33c77685f4a270f3cd1a1225a19275115e5ba048 (display-color-p): Use framep-on-display. (display-grayscale-p): New function. diff -r 33c77685f4a2 -r 4a4f7f602836 lisp/faces.el --- a/lisp/faces.el Wed Feb 02 11:35:43 2000 +0000 +++ b/lisp/faces.el Wed Feb 02 11:36:45 2000 +0000 @@ -1201,13 +1201,20 @@ The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display." - (if (and (stringp display) (not (fboundp 'x-display-list))) - nil - (if (memq (framep (or display (selected-frame))) '(x w32)) - (xw-display-color-p display) - (tty-display-color-p display)))) + (if (memq (framep-on-display display) '(x w32)) + (xw-display-color-p display) + (tty-display-color-p display))) (defalias 'x-display-color-p 'display-color-p) +(defun display-grayscale-p (&optional display) + "Return non-nil if frames on DISPLAY can display shades of gray." + (let ((frame-type (framep-on-display display))) + (cond + ((memq frame-type '(x w32 mac)) + (x-display-grayscale-p display)) + (t + (> (tty-color-gray-shades display) 2))))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Background mode.