comparison lisp/faces.el @ 265:8efd647ea9ca r20-5b31

Import from CVS: tag r20-5b31
author cvs
date Mon, 13 Aug 2007 10:25:37 +0200
parents 727739f917cb
children b2472a1930f2
comparison
equal deleted inserted replaced
264:682d2a9d41a5 265:8efd647ea9ca
1382 (defun init-global-faces () 1382 (defun init-global-faces ()
1383 ;; Look for global face resources. 1383 ;; Look for global face resources.
1384 (loop for face in (face-list) do 1384 (loop for face in (face-list) do
1385 (init-face-from-resources face 'global)) 1385 (init-face-from-resources face 'global))
1386 ;; Further X frobbing. 1386 ;; Further X frobbing.
1387 (case window-system 1387 (x-init-global-faces)
1388 (x (x-init-global-faces))
1389 (mswindows (mswindows-init-global-faces)))
1390 ;; for bold and the like, make the global specification be bold etc. 1388 ;; for bold and the like, make the global specification be bold etc.
1391 ;; if the user didn't already specify a value. These will also be 1389 ;; if the user didn't already specify a value. These will also be
1392 ;; frobbed further in init-other-random-faces. 1390 ;; frobbed further in init-other-random-faces.
1393 (unless (face-font 'bold 'global) 1391 (unless (face-font 'bold 'global)
1394 (make-face-bold 'bold 'global)) 1392 (make-face-bold 'bold 'global))
1516 (when (and (not (eq 'tty (device-type device))) 1514 (when (and (not (eq 'tty (device-type device)))
1517 (not (face-foreground 'text-cursor 'global)) 1515 (not (face-foreground 'text-cursor 'global))
1518 (face-property-equal 'text-cursor 'default 'foreground device)) 1516 (face-property-equal 'text-cursor 'default 'foreground device))
1519 (set-face-foreground 'text-cursor [default background] 'global 1517 (set-face-foreground 'text-cursor [default background] 'global
1520 nil 'append)) 1518 nil 'append))
1521
1522 ;; Set the secondary-selection color unless already specified.
1523 (unless (or (face-differs-from-default-p 'highlight device)
1524 (face-background 'highlight 'global))
1525 ;; some older servers don't recognize "darkseagreen2"
1526 (set-face-background 'highlight
1527 '((color . "darkseagreen2")
1528 (color . "green"))
1529 'global nil 'append)
1530 (set-face-background 'highlight "gray53" 'global 'grayscale 'append))
1531 (unless (or (face-differs-from-default-p 'highlight device)
1532 (face-background-pixmap 'highlight 'global))
1533 (set-face-background-pixmap 'highlight [nothing] 'global 'color 'append)
1534 (set-face-background-pixmap 'highlight [nothing] 'global 'grayscale 'append)
1535 (set-face-background-pixmap 'highlight "gray1" 'global 'mono 'append))
1536 ;; if the highlight face isn't distinguished on this device,
1537 ;; at least try inverting it.
1538 (unless (face-differs-from-default-p 'highlight device)
1539 (invert-face 'highlight device))
1540
1541 ;; first time through, set the zmacs-region color if it's not already
1542 ;; specified.
1543 (unless (or (face-differs-from-default-p 'zmacs-region device)
1544 (face-background 'zmacs-region 'global))
1545 (set-face-background 'zmacs-region "gray65" 'global 'color)
1546 (set-face-background 'zmacs-region "gray65" 'global 'grayscale))
1547 (unless (or (face-differs-from-default-p 'zmacs-region device)
1548 (face-background-pixmap 'zmacs-region 'global))
1549 (set-face-background-pixmap 'zmacs-region [nothing] 'global 'color)
1550 (set-face-background-pixmap 'zmacs-region [nothing] 'global 'grayscale)
1551 (set-face-background-pixmap 'zmacs-region "gray3" 'global 'mono))
1552 ;; if the zmacs-region face isn't distinguished on this device,
1553 ;; at least try inverting it.
1554 (unless (face-differs-from-default-p 'zmacs-region device)
1555 (invert-face 'zmacs-region device))
1556
1557 ;; first time through, set the list-mode-item-selected color if it's
1558 ;; not already specified.
1559 (unless (or (face-differs-from-default-p 'list-mode-item-selected device)
1560 (face-background 'list-mode-item-selected 'global))
1561 (set-face-background 'list-mode-item-selected "gray68" 'global 'color)
1562 (set-face-background 'list-mode-item-selected "gray68" 'global 'grayscale)
1563 (unless (face-foreground 'list-mode-item-selected 'global)
1564 (set-face-background 'list-mode-item-selected
1565 [default foreground] 'global '(mono x))
1566 (set-face-foreground 'list-mode-item-selected
1567 [default background] 'global '(mono x))))
1568
1569 ;; if the list-mode-item-selected face isn't distinguished on this device,
1570 ;; at least try inverting it.
1571 (unless (face-differs-from-default-p 'list-mode-item-selected device)
1572 (invert-face 'list-mode-item-selected device))
1573
1574 ;; Set the primary-selection color unless already specified.
1575 (unless (or (face-differs-from-default-p 'primary-selection device)
1576 (face-background 'primary-selection 'global))
1577 (set-face-background 'primary-selection "gray65" 'global 'color)
1578 (set-face-background 'primary-selection "gray65" 'global 'grayscale))
1579 (unless (or (face-differs-from-default-p 'secondary-selection device)
1580 (face-background-pixmap 'primary-selection 'global))
1581 (set-face-background-pixmap 'primary-selection "gray3" 'global 'mono))
1582 ;; If the primary-selection face isn't distinguished on this device,
1583 ;; at least try inverting it.
1584 (unless (face-differs-from-default-p 'primary-selection device)
1585 (invert-face 'primary-selection device))
1586
1587 ;; Set the secondary-selection color unless already specified.
1588 (unless (or (face-differs-from-default-p 'secondary-selection device)
1589 (face-background 'secondary-selection 'global))
1590 (set-face-background 'secondary-selection
1591 '((color . "paleturquoise")
1592 (color . "green"))
1593 'global)
1594 (set-face-background 'secondary-selection "gray53" 'global
1595 'grayscale))
1596 (unless (or (face-differs-from-default-p 'secondary-selection device)
1597 (face-background-pixmap 'secondary-selection 'global))
1598 (set-face-background-pixmap 'secondary-selection "gray1" 'global 'mono))
1599 ;; If the secondary-selection face isn't distinguished on this device,
1600 ;; at least try inverting it.
1601 (unless (face-differs-from-default-p 'secondary-selection device)
1602 (invert-face 'secondary-selection device))
1603
1604 ;; Set the isearch color if unless already specified.
1605 (unless (or (face-differs-from-default-p 'isearch device)
1606 (face-background 'isearch 'global))
1607 ;; TTY's and some older X servers don't recognize "paleturquoise"
1608 (set-face-background 'isearch
1609 '((color . "paleturquoise")
1610 (color . "green"))
1611 'global))
1612 ;; if the isearch face isn't distinguished (e.g. we're not on a color
1613 ;; display), at least try making it bold.
1614 (unless (face-differs-from-default-p 'isearch device)
1615 (set-face-font 'isearch [bold]))
1616 ) 1519 )
1617 1520
1618 ;; New function with 20.1, suggested by Per Abrahamsen, coded by Kyle Jones. 1521 ;; New function with 20.1, suggested by Per Abrahamsen, coded by Kyle Jones.
1619 (defun set-face-stipple (face pixmap &optional frame) 1522 (defun set-face-stipple (face pixmap &optional frame)
1620 "Change the stipple pixmap of face FACE to PIXMAP. 1523 "Change the stipple pixmap of face FACE to PIXMAP.
1658 (make-face 'bold "Bold text.") 1561 (make-face 'bold "Bold text.")
1659 (make-face 'italic "Italic text.") 1562 (make-face 'italic "Italic text.")
1660 (make-face 'bold-italic "Bold-italic text.") 1563 (make-face 'bold-italic "Bold-italic text.")
1661 (make-face 'underline "Underlined text.") 1564 (make-face 'underline "Underlined text.")
1662 (or (face-differs-from-default-p 'underline) 1565 (or (face-differs-from-default-p 'underline)
1663 (set-face-underline-p 'underline t 'global)) 1566 (set-face-underline-p 'underline t 'global '(default)))
1664 (make-face 'zmacs-region "Used on highlightes region between point and mark.") 1567 (make-face 'zmacs-region "Used on highlightes region between point and mark.")
1665 (make-face 'isearch "Used on region matched by isearch.") 1568 (make-face 'isearch "Used on region matched by isearch.")
1666 (make-face 'list-mode-item-selected 1569 (make-face 'list-mode-item-selected
1667 "Face for the selected list item in list-mode.") 1570 "Face for the selected list item in list-mode.")
1668 (make-face 'highlight "Highlight face.") 1571 (make-face 'highlight "Highlight face.")
1674 (dolist (color '(red green blue yellow)) 1577 (dolist (color '(red green blue yellow))
1675 (make-face color (concat (symbol-name color) " text.")) 1578 (make-face color (concat (symbol-name color) " text."))
1676 (set-face-foreground color (symbol-name color) nil 'color)) 1579 (set-face-foreground color (symbol-name color) nil 'color))
1677 1580
1678 ;; Make some useful faces. This happens very early, before creating 1581 ;; Make some useful faces. This happens very early, before creating
1679 ;; the first non-stream device. We initialize the tty global values here. 1582 ;; the first non-stream device.
1680 ;; We cannot initialize the X global values here because they depend 1583
1681 ;; on having already resourced the global face specs, which happens 1584 (set-face-background 'text-cursor
1682 ;; when the first X device is created. 1585 '(((default x) . "Red3")
1586 ((default mswindows) . "Red3"))
1587 'global)
1588
1589 ;; some older servers don't recognize "darkseagreen2"
1590 (set-face-background 'highlight
1591 '(((default color) . "darkseagreen2")
1592 ((default color) . "green")
1593 ((default grayscale) . "gray53"))
1594 'global)
1595 (set-face-background-pixmap 'highlight "gray1" 'global '(default mono))
1596
1597 (set-face-background 'zmacs-region "gray65" 'global '(default color))
1598 (set-face-background 'zmacs-region "gray65" 'global '(default grayscale))
1599 (set-face-background-pixmap 'zmacs-region "gray3" 'global '(default mono))
1600
1601 (set-face-background 'list-mode-item-selected "gray68" 'global
1602 '(default color))
1603 (set-face-background 'list-mode-item-selected "gray68" 'global
1604 '(default grayscale))
1605 (set-face-background 'list-mode-item-selected
1606 [default foreground] 'global '(default mono))
1607 (set-face-foreground 'list-mode-item-selected
1608 [default background] 'global '(default mono))
1609
1610 (set-face-background 'primary-selection "gray65" 'global '(default color))
1611 (set-face-background 'primary-selection "gray65" 'global '(default grayscale))
1612 (set-face-background-pixmap 'primary-selection "gray3" 'global '(default mono))
1613
1614 (set-face-background 'secondary-selection
1615 '(((default color) . "paleturquoise")
1616 ((default color) . "green")
1617 ((default grayscale) . "gray53"))
1618 'global)
1619 (set-face-background-pixmap 'secondary-selection "gray1" 'global
1620 '(default mono))
1621
1622 (set-face-background 'isearch
1623 '(((default color) . "paleturquoise")
1624 ((default color) . "green"))
1625 'global)
1683 1626
1684 (when (featurep 'tty) 1627 (when (featurep 'tty)
1685 (set-face-highlight-p 'bold t 'global 'tty) 1628 (set-face-highlight-p 'bold t 'global '(default tty))
1686 (set-face-underline-p 'italic t 'global 'tty) 1629 (set-face-underline-p 'italic t 'global '(default tty))
1687 (set-face-highlight-p 'bold-italic t 'global 'tty) 1630 (set-face-highlight-p 'bold-italic t 'global '(default tty))
1688 (set-face-underline-p 'bold-italic t 'global 'tty) 1631 (set-face-underline-p 'bold-italic t 'global '(default tty))
1689 (set-face-highlight-p 'highlight t 'global 'tty) 1632 (set-face-highlight-p 'highlight t 'global '(default tty))
1690 (set-face-reverse-p 'text-cursor t 'global 'tty) 1633 (set-face-reverse-p 'text-cursor t 'global '(default tty))
1691 (set-face-reverse-p 'modeline t 'global 'tty) 1634 (set-face-reverse-p 'modeline t 'global '(default tty))
1692 (set-face-reverse-p 'zmacs-region t 'global 'tty) 1635 (set-face-reverse-p 'zmacs-region t 'global '(default tty))
1693 (set-face-reverse-p 'primary-selection t 'global 'tty) 1636 (set-face-reverse-p 'primary-selection t 'global '(default tty))
1694 (set-face-underline-p 'secondary-selection t 'global 'tty) 1637 (set-face-underline-p 'secondary-selection t 'global '(default tty))
1695 (set-face-reverse-p 'list-mode-item-selected t 'global 'tty) 1638 (set-face-reverse-p 'list-mode-item-selected t 'global '(default tty))
1696 (set-face-reverse-p 'isearch t 'global 'tty) 1639 (set-face-reverse-p 'isearch t 'global '(default tty))
1697 ) 1640 )
1698 1641
1699 ;;; faces.el ends here 1642 ;;; faces.el ends here