comparison lisp/faces.el @ 32734:92b46ad86f6a

(color-values, color-defined-p): Use `member', not `memq', because it works correctly for strings. (frame-set-background-mode): Actually, "unspecified-fg" and "unspecified-bg" *are* strings. Use `member', not `memq', and `equal', not `eq', when a string value is possible.
author Miles Bader <miles@gnu.org>
date Sat, 21 Oct 2000 22:27:42 +0000
parents 47bf921bccd5
children 923b8d6d8277
comparison
equal deleted inserted replaced
32733:b8e798d15716 32734:92b46ad86f6a
1239 (defun color-defined-p (color &optional frame) 1239 (defun color-defined-p (color &optional frame)
1240 "Return non-nil if color COLOR is supported on frame FRAME. 1240 "Return non-nil if color COLOR is supported on frame FRAME.
1241 If FRAME is omitted or nil, use the selected frame. 1241 If FRAME is omitted or nil, use the selected frame.
1242 If COLOR is the symbol `unspecified' or one of the strings 1242 If COLOR is the symbol `unspecified' or one of the strings
1243 \"unspecified-fg\" or \"unspecified-bg\", the value is nil." 1243 \"unspecified-fg\" or \"unspecified-bg\", the value is nil."
1244 (if (memq color '(unspecified "unspecified-bg" "unspecified-fg")) 1244 (if (member color '(unspecified "unspecified-bg" "unspecified-fg"))
1245 nil 1245 nil
1246 (if (memq (framep (or frame (selected-frame))) '(x w32)) 1246 (if (member (framep (or frame (selected-frame))) '(x w32))
1247 (xw-color-defined-p color frame) 1247 (xw-color-defined-p color frame)
1248 (numberp (tty-color-translate color frame))))) 1248 (numberp (tty-color-translate color frame)))))
1249 (defalias 'x-color-defined-p 'color-defined-p) 1249 (defalias 'x-color-defined-p 'color-defined-p)
1250 1250
1251 (defun color-values (color &optional frame) 1251 (defun color-values (color &optional frame)
1254 These values appear to range from 0 65535; white is \(65535 65535 65535\). 1254 These values appear to range from 0 65535; white is \(65535 65535 65535\).
1255 If FRAME is omitted or nil, use the selected frame. 1255 If FRAME is omitted or nil, use the selected frame.
1256 If FRAME cannot display COLOR, the value is nil. 1256 If FRAME cannot display COLOR, the value is nil.
1257 If COLOR is the symbol `unspecified' or one of the strings 1257 If COLOR is the symbol `unspecified' or one of the strings
1258 \"unspecified-fg\" or \"unspecified-bg\", the value is nil." 1258 \"unspecified-fg\" or \"unspecified-bg\", the value is nil."
1259 (if (memq color '(unspecified "unspecified-fg" "unspecified-bg")) 1259 (if (member color '(unspecified "unspecified-fg" "unspecified-bg"))
1260 nil 1260 nil
1261 (if (memq (framep (or frame (selected-frame))) '(x w32)) 1261 (if (memq (framep (or frame (selected-frame))) '(x w32))
1262 (xw-color-values color frame) 1262 (xw-color-values color frame)
1263 (tty-color-values color frame)))) 1263 (tty-color-values color frame))))
1264 (defalias 'x-color-values 'color-values) 1264 (defalias 'x-color-values 'color-values)
1318 ((and (null window-system) (null bg-color)) 1318 ((and (null window-system) (null bg-color))
1319 ;; No way to determine this automatically (?). 1319 ;; No way to determine this automatically (?).
1320 'dark) 1320 'dark)
1321 ;; Unspecified frame background color can only happen 1321 ;; Unspecified frame background color can only happen
1322 ;; on tty's. 1322 ;; on tty's.
1323 ((memq bg-color '(unspecified unspecified-bg)) 1323 ((member bg-color '(unspecified "unspecified-bg"))
1324 'dark) 1324 'dark)
1325 ((eq bg-color 'unspecified-fg) ; inverted colors 1325 ((equal bg-color "unspecified-fg") ; inverted colors
1326 'light) 1326 'light)
1327 ((>= (apply '+ (x-color-values bg-color frame)) 1327 ((>= (apply '+ (x-color-values bg-color frame))
1328 ;; Just looking at the screen, colors whose 1328 ;; Just looking at the screen, colors whose
1329 ;; values add up to .6 of the white total 1329 ;; values add up to .6 of the white total
1330 ;; still look dark to me. 1330 ;; still look dark to me.