comparison lisp/faces.el @ 90199:bb71c6cf2009

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-67 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 447-458) - Update from CVS - Update from CVS: lisp/subr.el (add-to-ordered-list): Doc fix. - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 83-85) - Merge from emacs--cvs-trunk--0 - Update from CVS
author Miles Bader <miles@gnu.org>
date Thu, 30 Jun 2005 00:31:46 +0000
parents b7da78284d4c 379e37eca752
children f9a65d7ebd29
comparison
equal deleted inserted replaced
90198:97f6c3a96df1 90199:bb71c6cf2009
202 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 202 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
203 ;;; Predicates, type checks. 203 ;;; Predicates, type checks.
204 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 204 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
205 205
206 (defun facep (face) 206 (defun facep (face)
207 "Return non-nil if FACE is a face name." 207 "Return non-nil if FACE is a face name or internal face object.
208 Return nil otherwise. A face name can be a string or a symbol.
209 An internal face object is a vector of the kind used internally
210 to record face data."
208 (internal-lisp-face-p face)) 211 (internal-lisp-face-p face))
209 212
210 213
211 (defun check-face (face) 214 (defun check-face (face)
212 "Signal an error if FACE doesn't name a face. 215 "Signal an error if FACE doesn't name a face.
1571 :initialize 'custom-initialize-changed 1574 :initialize 'custom-initialize-changed
1572 :type '(choice (choice-item dark) 1575 :type '(choice (choice-item dark)
1573 (choice-item light) 1576 (choice-item light)
1574 (choice-item :tag "default" nil))) 1577 (choice-item :tag "default" nil)))
1575 1578
1579 (defvar default-frame-background-mode nil
1580 "Internal variable for the default brightness of the background.
1581 Emacs sets it automatically depending on the terminal type.
1582 The value `nil' means `dark'. If Emacs runs in non-windowed
1583 mode from `xterm' or a similar terminal emulator, the value is
1584 `light'. On rxvt terminals, the value depends on the environment
1585 variable COLORFGBG.")
1576 1586
1577 (defun frame-set-background-mode (frame) 1587 (defun frame-set-background-mode (frame)
1578 "Set up display-dependent faces on FRAME. 1588 "Set up display-dependent faces on FRAME.
1579 Display-dependent faces are those which have different definitions 1589 Display-dependent faces are those which have different definitions
1580 according to the `background-mode' and `display-type' frame parameters." 1590 according to the `background-mode' and `display-type' frame parameters."
1586 (cond (frame-background-mode) 1596 (cond (frame-background-mode)
1587 (bg-resource 1597 (bg-resource
1588 (intern (downcase bg-resource))) 1598 (intern (downcase bg-resource)))
1589 ((and (null window-system) (null bg-color)) 1599 ((and (null window-system) (null bg-color))
1590 ;; No way to determine this automatically (?). 1600 ;; No way to determine this automatically (?).
1591 'dark) 1601 (or default-frame-background-mode 'dark))
1592 ;; Unspecified frame background color can only happen 1602 ;; Unspecified frame background color can only happen
1593 ;; on tty's. 1603 ;; on tty's.
1594 ((member bg-color '(unspecified "unspecified-bg")) 1604 ((member bg-color '(unspecified "unspecified-bg"))
1595 'dark) 1605 (or default-frame-background-mode 'dark))
1596 ((equal bg-color "unspecified-fg") ; inverted colors 1606 ((equal bg-color "unspecified-fg") ; inverted colors
1597 'light) 1607 (if (eq default-frame-background-mode 'light) 'dark 'light))
1598 ((>= (apply '+ (x-color-values bg-color frame)) 1608 ((>= (apply '+ (x-color-values bg-color frame))
1599 ;; Just looking at the screen, colors whose 1609 ;; Just looking at the screen, colors whose
1600 ;; values add up to .6 of the white total 1610 ;; values add up to .6 of the white total
1601 ;; still look dark to me. 1611 ;; still look dark to me.
1602 (* (apply '+ (x-color-values "white" frame)) .6)) 1612 (* (apply '+ (x-color-values "white" frame)) .6))