]> code.delx.au - gnu-emacs/commitdiff
(face-initialize): Create `underline' face.
authorRichard M. Stallman <rms@gnu.org>
Mon, 28 Jun 1993 20:38:49 +0000 (20:38 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 28 Jun 1993 20:38:49 +0000 (20:38 +0000)
(x-initialize-frame-faces): Set up `underline' face.

(x-initialize-frame-faces): Check x-display-color-p
and x-display-planes to decide whether to try using colors or gray.

lisp/faces.el

index f08d7631ffa1b41217f29e32fc073f8e652ad5ef..d2be0537beaf945994c1fc4264064f514cbc393c 100644 (file)
@@ -634,6 +634,7 @@ If NOERROR is non-nil, return nil on failure."
   (make-face 'bold-italic)
   (make-face 'region)
   (make-face 'secondary-selection)
+  (make-face 'underline)
 
   (setq region-face (face-id 'region))
 
@@ -697,31 +698,42 @@ If NOERROR is non-nil, return nil on failure."
       )
 
   (or (face-differs-from-default-p 'highlight frame)
-      (condition-case ()
-         (condition-case ()
-             (set-face-background 'highlight "darkseagreen2" frame)
-           (error (set-face-background 'highlight "green" frame)))
+      (if (or (not (x-display-color-p))
+             (= (x-display-planes) 1))
+         (invert-face 'highlight frame)
+       (condition-case ()
+           (condition-case ()
+               (set-face-background 'highlight "darkseagreen2" frame)
+             (error (set-face-background 'highlight "green" frame)))
 ;;;        (set-face-background-pixmap 'highlight "gray1" frame)
-       (error (invert-face 'highlight frame))))
+         (error (invert-face 'highlight frame)))))
 
   (or (face-differs-from-default-p 'region frame)
-      (condition-case ()
-         (set-face-background 'region "gray" frame)
-       (error (invert-face 'region frame))))
+      (if (= (x-display-planes) 1)
+         (invert-face 'region frame)
+       (condition-case ()
+           (set-face-background 'region "gray" frame)
+         (error (invert-face 'region frame)))))
 
   (or (face-differs-from-default-p 'modeline frame)
       (invert-face 'modeline frame))
 
+  (or (face-differs-from-default-p 'underline frame)
+      (set-face-underline-p 'underline t frame))
+
   (or (face-differs-from-default-p 'secondary-selection frame)
-      (condition-case ()
-         (condition-case ()
-             ;; some older X servers don't have this one.
-             (set-face-background 'secondary-selection "paleturquoise"
-                                  frame)
-           (error
-            (set-face-background 'secondary-selection "green" frame)))
+      (if (or (not (x-display-color-p))
+             (= (x-display-planes) 1))
+         (invert-face 'secondary-selection frame)
+       (condition-case ()
+           (condition-case ()
+               ;; some older X servers don't have this one.
+               (set-face-background 'secondary-selection "paleturquoise"
+                                    frame)
+             (error
+              (set-face-background 'secondary-selection "green" frame)))
 ;;;        (set-face-background-pixmap 'secondary-selection "gray1" frame)
-       (error (invert-face 'secondary-selection frame))))
+         (error (invert-face 'secondary-selection frame)))))
   )
 
 (defun internal-x-complain-about-font (face frame)