unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@ics.uci.edu>
Cc: emacs-devel@gnu.org
Subject: Re: supporting more faces on 256 colors xterms
Date: Fri, 13 Feb 2004 12:29:00 -0800	[thread overview]
Message-ID: <200402132028.i1DKSwY7013278@scanner2.ics.uci.edu> (raw)
In-Reply-To: <3405-Fri13Feb2004105715+0200-eliz@elta.co.il>

[-- Attachment #1: Type: text/plain, Size: 2095 bytes --]

"Eli Zaretskii" <eliz@elta.co.il> writes:

  > > From: Dan Nicolaescu <dann@ics.uci.edu>
  > > Date: Thu, 12 Feb 2004 14:13:34 -0800
  > > 
  > > The default faces and the font-lock faces have been changed to take
  > > advantage of `min-colors'. These faces look very similar now on a 256
  > > colors xterm and on X11.
  > 
  > Thanks.
  > 
  > I see one problem with these changes: it seems like you assumed that
  > there are no devices supported by the current defface definitions that
  > can support between 8 and 256 colors.  But that is not true: the MSDOS
  > terminal and the Windows character terminal (you get the latter when
  > you start the Windows port with -nw) both support 16 colors, not 8.

Right, I had no idea that this was the case. My intention was to keep
the status quo for everything except the 256/88 color xterms. 

  > I think that adding a definition for (min-colors 16) is a Good
  > Thing regardless, as there's rxvt and a 16-color xterm out there.

Thanks for the detailed explanations on how these things currently
work. I have an updated patch. Could you please test it on
MSDOS/Windows and tell me if the face colors are the same before and
after my patch? I don't have access to such a machine, so I cannot
test this myself.
If anything is changed, could you please email me the output of the
following function?

(defun list-faces-display-simple ()
  "Show fg and bg."
  (interactive)
  (let ((faces (sort (face-list) #'string-lessp))
	(face nil)
	(frame (selected-frame))
	disp-frame window face-name)
    (with-output-to-temp-buffer "*SimpleFaces*"
      (save-excursion
	(set-buffer standard-output)
	(setq truncate-lines t)
	(while faces
	  (setq face (car faces))
	  (setq faces (cdr faces))
	  (setq face-name (symbol-name face))
	  (insert (format "%32s fg: %-15s bg: %-15s\n" 
			  face-name
			  (face-foreground face)
			  (face-background face)
			  )))))))

I added separate "min-colors 16" categories everywhere I thought
they'd be needed. This way it would be easier to change the
corresponding colors later, if there's a desire to do so. 


[-- Attachment #2: PATCH --]
[-- Type: text/plain, Size: 19521 bytes --]

Index: faces.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/faces.el,v
retrieving revision 1.280
diff -c -3 -p -r1.280 faces.el
*** faces.el	1 Sep 2003 15:45:11 -0000	1.280
--- faces.el	13 Feb 2004 20:11:16 -0000
*************** If FRAME is nil, the current FRAME is us
*** 1314,1319 ****
--- 1314,1321 ----
  				  (not (featurep 'motif)))
  			     (and (memq 'x-toolkit options)
  				  (featurep 'x-toolkit))))
+ 			((eq req 'min-colors)
+ 			 (>= (display-color-cells frame) (car options)))
  			((eq req 'class)
  			 (memq (frame-parameter frame 'display-type) options))
  			((eq req 'background)
*************** created."
*** 1892,1905 ****
        (append minibuffer-prompt-properties (list 'face 'minibuffer-prompt)))
  
  (defface region
!   '((((type tty) (class color))
       :background "blue" :foreground "white")
      (((type tty) (class mono))
       :inverse-video t)
-     (((class color) (background dark))
-      :background "blue3")
-     (((class color) (background light))
-      :background "lightgoldenrod2")
      (t :background "gray"))
    "Basic face for highlighting the region."
    :version "21.1"
--- 1894,1911 ----
        (append minibuffer-prompt-properties (list 'face 'minibuffer-prompt)))
  
  (defface region
!   '((((class color) (min-colors 88) (background dark))
!      :background "blue3")
!     (((class color) (min-colors 88) (background light))
!      :background "lightgoldenrod2")
!     (((class color) (min-colors 16) (background dark))
!      :background "blue3")
!     (((class color) (min-colors 16) (background light))
!      :background "lightgoldenrod2")
!     (((class color) (min-colors 8))
       :background "blue" :foreground "white")
      (((type tty) (class mono))
       :inverse-video t)
      (t :background "gray"))
    "Basic face for highlighting the region."
    :version "21.1"
*************** created."
*** 1990,2013 ****
  
  
  (defface highlight
!   '((((type tty) (class color))
!      :background "green" :foreground "black")
!     (((class color) (background light))
       :background "darkseagreen2")
!     (((class color) (background dark))
       :background "darkolivegreen")
      (t :inverse-video t))
    "Basic face for highlighting."
    :group 'basic-faces)
  
  
  (defface secondary-selection
!   '((((type tty) (class color))
!      :background "cyan" :foreground "black")
!     (((class color) (background light))
       :background "yellow")
!     (((class color) (background dark))
       :background "SkyBlue4")
      (t :inverse-video t))
    "Basic face for displaying the secondary selection."
    :group 'basic-faces)
--- 1996,2027 ----
  
  
  (defface highlight
!   '((((class color) (min-colors 88) (background light))
       :background "darkseagreen2")
!     (((class color) (min-colors 88) (background dark))
       :background "darkolivegreen")
+     (((class color) (min-colors 16) (background light))
+      :background "darkseagreen2")
+     (((class color) (min-colors 16) (background dark))
+      :background "darkolivegreen")
+     (((class color) (min-colors 8))
+      :background "green" :foreground "black")
      (t :inverse-video t))
    "Basic face for highlighting."
    :group 'basic-faces)
  
  
  (defface secondary-selection
!   '((((class color) (min-colors 88) (background light))
       :background "yellow")
!     (((class color) (min-colors 88) (background dark))
!      :background "SkyBlue4")
!     (((class color) (min-colors 16) (background light))
!      :background "yellow")
!     (((class color) (min-colors 16) (background dark))
       :background "SkyBlue4")
+     (((class color) (min-colors 8))
+      :background "cyan" :foreground "black")
      (t :inverse-video t))
    "Basic face for displaying the secondary selection."
    :group 'basic-faces)
Index: font-lock.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/font-lock.el,v
retrieving revision 1.214
diff -c -3 -p -r1.214 font-lock.el
*** font-lock.el	26 Jan 2004 23:03:43 -0000	1.214
--- font-lock.el	13 Feb 2004 20:11:17 -0000
*************** Sets various variables using `font-lock-
*** 1560,1583 ****
  ;; But now we do it the custom way.  Note that `defface' will not overwrite any
  ;; faces declared above via `custom-declare-face'.
  (defface font-lock-comment-face
!   '((((type tty pc) (class color) (background light)) (:foreground "red"))
!     (((type tty pc) (class color) (background dark)) (:foreground "red1"))
!     (((class grayscale) (background light))
       (:foreground "DimGray" :weight bold :slant italic))
      (((class grayscale) (background dark))
       (:foreground "LightGray" :weight bold :slant italic))
!     (((class color) (background light)) (:foreground "Firebrick"))
!     (((class color) (background dark)) (:foreground "chocolate1"))
      (t (:weight bold :slant italic)))
    "Font Lock mode face used to highlight comments."
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-string-face
!   '((((type tty) (class color)) (:foreground "green"))
!     (((class grayscale) (background light)) (:foreground "DimGray" :slant italic))
      (((class grayscale) (background dark)) (:foreground "LightGray" :slant italic))
!     (((class color) (background light)) (:foreground "RosyBrown"))
!     (((class color) (background dark)) (:foreground "LightSalmon"))
      (t (:slant italic)))
    "Font Lock mode face used to highlight strings."
    :group 'font-lock-highlighting-faces)
--- 1560,1593 ----
  ;; But now we do it the custom way.  Note that `defface' will not overwrite any
  ;; faces declared above via `custom-declare-face'.
  (defface font-lock-comment-face
!   '((((class grayscale) (background light))
       (:foreground "DimGray" :weight bold :slant italic))
      (((class grayscale) (background dark))
       (:foreground "LightGray" :weight bold :slant italic))
!     (((class color) (min-colors 88) (background light)) 
!      (:foreground "Firebrick"))
!     (((class color) (min-colors 88) (background dark)) 
!      (:foreground "chocolate1"))
!     (((class color) (min-colors 16) (background light)) 
!      (:foreground "red"))
!     (((class color) (min-colors 16) (background dark)) 
!      (:foreground "red1"))
!     (((class color) (min-colors 8) (background light)) 
!      (:foreground "red"))
!     (((class color) (min-colors 8) (background dark)) 
!      (:foreground "red1"))
      (t (:weight bold :slant italic)))
    "Font Lock mode face used to highlight comments."
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-string-face
!   '((((class grayscale) (background light)) (:foreground "DimGray" :slant italic))
      (((class grayscale) (background dark)) (:foreground "LightGray" :slant italic))
!     (((class color) (min-colors 88) (background light)) (:foreground "RosyBrown"))
!     (((class color) (min-colors 88) (background dark)) (:foreground "LightSalmon"))
!     (((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
!     (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
!     (((class color) (min-colors 8)) (:foreground "green"))
      (t (:slant italic)))
    "Font Lock mode face used to highlight strings."
    :group 'font-lock-highlighting-faces)
*************** Sets various variables using `font-lock-
*** 1588,1658 ****
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-keyword-face
!   '((((type tty) (class color)) (:foreground "cyan" :weight bold))
!     (((class grayscale) (background light)) (:foreground "LightGray" :weight bold))
      (((class grayscale) (background dark)) (:foreground "DimGray" :weight bold))
!     (((class color) (background light)) (:foreground "Purple"))
!     (((class color) (background dark)) (:foreground "Cyan"))
      (t (:weight bold)))
    "Font Lock mode face used to highlight keywords."
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-builtin-face
!   '((((type tty) (class color)) (:foreground "blue" :weight light))
!     (((class grayscale) (background light)) (:foreground "LightGray" :weight bold))
      (((class grayscale) (background dark)) (:foreground "DimGray" :weight bold))
!     (((class color) (background light)) (:foreground "Orchid"))
!     (((class color) (background dark)) (:foreground "LightSteelBlue"))
      (t (:weight bold)))
    "Font Lock mode face used to highlight builtins."
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-function-name-face
!   '((((type tty) (class color)) (:foreground "blue" :weight bold))
!     (((class color) (background light)) (:foreground "Blue"))
!     (((class color) (background dark)) (:foreground "LightSkyBlue"))
      (t (:inverse-video t :weight bold)))
    "Font Lock mode face used to highlight function names."
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-variable-name-face
!   '((((type tty) (class color)) (:foreground "yellow" :weight light))
!     (((class grayscale) (background light))
       (:foreground "Gray90" :weight bold :slant italic))
      (((class grayscale) (background dark))
       (:foreground "DimGray" :weight bold :slant italic))
!     (((class color) (background light)) (:foreground "DarkGoldenrod"))
!     (((class color) (background dark)) (:foreground "LightGoldenrod"))
      (t (:weight bold :slant italic)))
    "Font Lock mode face used to highlight variable names."
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-type-face
!   '((((type tty) (class color)) (:foreground "green"))
!     (((class grayscale) (background light)) (:foreground "Gray90" :weight bold))
      (((class grayscale) (background dark)) (:foreground "DimGray" :weight bold))
!     (((class color) (background light)) (:foreground "ForestGreen"))
!     (((class color) (background dark)) (:foreground "PaleGreen"))
      (t (:weight bold :underline t)))
    "Font Lock mode face used to highlight type and classes."
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-constant-face
!   '((((type tty) (class color)) (:foreground "magenta"))
!     (((class grayscale) (background light))
       (:foreground "LightGray" :weight bold :underline t))
      (((class grayscale) (background dark))
       (:foreground "Gray50" :weight bold :underline t))
!     (((class color) (background light)) (:foreground "CadetBlue"))
!     (((class color) (background dark)) (:foreground "Aquamarine"))
      (t (:weight bold :underline t)))
    "Font Lock mode face used to highlight constants and labels."
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-warning-face
!   '((((type tty) (class color)) (:foreground "red"))
!     (((class color) (background light)) (:foreground "Red" :weight bold))
!     (((class color) (background dark)) (:foreground "Pink" :weight bold))
      (t (:inverse-video t :weight bold)))
    "Font Lock mode face used to highlight warnings."
    :group 'font-lock-highlighting-faces)
--- 1598,1681 ----
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-keyword-face
!   '((((class grayscale) (background light)) (:foreground "LightGray" :weight bold))
      (((class grayscale) (background dark)) (:foreground "DimGray" :weight bold))
!     (((class color) (min-colors 88) (background light)) (:foreground "Purple"))
!     (((class color) (min-colors 88) (background dark)) (:foreground "Cyan"))
!     (((class color) (min-colors 16) (background light)) (:foreground "Purple"))
!     (((class color) (min-colors 16) (background dark)) (:foreground "Cyan"))
!     (((class color) (min-colors 8)) (:foreground "cyan" :weight bold))
      (t (:weight bold)))
    "Font Lock mode face used to highlight keywords."
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-builtin-face
!   '((((class grayscale) (background light)) (:foreground "LightGray" :weight bold))
      (((class grayscale) (background dark)) (:foreground "DimGray" :weight bold))
!     (((class color) (min-colors 88) (background light)) (:foreground "Orchid"))
!     (((class color) (min-colors 88) (background dark)) (:foreground "LightSteelBlue"))
!     (((class color) (min-colors 16) (background light)) (:foreground "Orchid"))
!     (((class color) (min-colors 16) (background dark)) (:foreground "LightSteelBlue"))
!     (((class color) (min-colors 8)) (:foreground "blue" :weight bold))
      (t (:weight bold)))
    "Font Lock mode face used to highlight builtins."
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-function-name-face
!   '((((class color) (min-colors 88) (background light)) (:foreground "Blue"))
!     (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
!     (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
!     (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
!     (((class color) (min-colors 8)) (:foreground "blue" :weight bold))
      (t (:inverse-video t :weight bold)))
    "Font Lock mode face used to highlight function names."
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-variable-name-face
!   '((((class grayscale) (background light))
       (:foreground "Gray90" :weight bold :slant italic))
      (((class grayscale) (background dark))
       (:foreground "DimGray" :weight bold :slant italic))
!     (((class color) (min-colors 88) (background light)) (:foreground "DarkGoldenrod"))
!     (((class color) (min-colors 88) (background dark)) (:foreground "LightGoldenrod"))
!     (((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
!     (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
!     (((class color) (min-colors 8)) (:foreground "yellow" :weight light))
      (t (:weight bold :slant italic)))
    "Font Lock mode face used to highlight variable names."
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-type-face
!   '((((class grayscale) (background light)) (:foreground "Gray90" :weight bold))
      (((class grayscale) (background dark)) (:foreground "DimGray" :weight bold))
!     (((class color) (min-colors 88) (background light)) (:foreground "ForestGreen"))
!     (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
!     (((class color) (min-colors 16) (background light)) (:foreground "ForestGreen"))
!     (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen"))
!     (((class color) (min-colors 8)) (:foreground "green"))
      (t (:weight bold :underline t)))
    "Font Lock mode face used to highlight type and classes."
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-constant-face
!   '((((class grayscale) (background light))
       (:foreground "LightGray" :weight bold :underline t))
      (((class grayscale) (background dark))
       (:foreground "Gray50" :weight bold :underline t))
!     (((class color) (min-colors 88) (background light)) (:foreground "CadetBlue"))
!     (((class color) (min-colors 88) (background dark)) (:foreground "Aquamarine"))
!     (((class color) (min-colors 16) (background light)) (:foreground "CadetBlue"))
!     (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine"))
!     (((class color) (min-colors 8)) (:foreground "magenta"))
      (t (:weight bold :underline t)))
    "Font Lock mode face used to highlight constants and labels."
    :group 'font-lock-highlighting-faces)
  
  (defface font-lock-warning-face
!   '((((class color) (min-colors 88) (background light)) (:foreground "Red" :weight bold))
!     (((class color) (min-colors 88) (background dark)) (:foreground "Pink" :weight bold))
!     (((class color) (min-colors 16) (background light)) (:foreground "Red" :weight bold))
!     (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :weight bold))    (((class color) (min-colors 8)) (:foreground "red"))
      (t (:inverse-video t :weight bold)))
    "Font Lock mode face used to highlight warnings."
    :group 'font-lock-highlighting-faces)
Index: custom.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/custom.el,v
retrieving revision 1.70
diff -c -3 -p -r1.70 custom.el
*** custom.el	29 Dec 2003 11:53:19 -0000	1.70
--- custom.el	13 Feb 2004 20:11:17 -0000
*************** following REQ are defined:
*** 306,311 ****
--- 306,315 ----
  `background' (what color is used for the background text)
    Should be one of `light' or `dark'.
  
+ `min-colors' (the minimum number of colors the frame should support)
+   Should be an integer, it is compared with the result of
+   `display-color-cells'.
+ 
  Read the section about customization in the Emacs Lisp manual for more
  information."
    ;; It is better not to use backquote in this file,
Index: isearch.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.223
diff -c -3 -p -r1.223 isearch.el
*** isearch.el	1 Nov 2003 17:00:02 -0000	1.223
--- isearch.el	13 Feb 2004 20:11:17 -0000
*************** A value of nil means highlight all match
*** 2128,2153 ****
    :group 'isearch)
  
  (defface isearch
!   '((((type tty pc) (class color))
!      (:background "magenta4" :foreground "cyan1"))
!     (((class color) (background light))
       ;; The background must not be too dark, for that means
       ;; the character is hard to see when the cursor is there.
       (:background "magenta2" :foreground "lightskyblue1"))
!     (((class color) (background dark))
       (:background "palevioletred2" :foreground "brown4"))
      (t (:inverse-video t)))
    "Face for highlighting Isearch matches."
    :group 'isearch-faces)
  (defvar isearch 'isearch)
  
  (defface isearch-lazy-highlight-face
!   '((((type tty pc) (class color))
!      (:background "turquoise3"))
!     (((class color) (background light))
       (:background "paleturquoise"))
!     (((class color) (background dark))
       (:background "paleturquoise4"))
      (t (:underline t)))
    "Face for lazy highlighting of Isearch matches other than the current one."
    :group 'isearch-faces)
--- 2128,2157 ----
    :group 'isearch)
  
  (defface isearch
!   '((((class color) (min-colors 88) (background light))
       ;; The background must not be too dark, for that means
       ;; the character is hard to see when the cursor is there.
       (:background "magenta2" :foreground "lightskyblue1"))
!     (((class color) (min-colors 88) (background dark))
       (:background "palevioletred2" :foreground "brown4"))
+     (((class color) (min-colors 16))
+      (:background "magenta4" :foreground "cyan1"))
+     (((class color) (min-colors 8))
+      (:background "magenta4" :foreground "cyan1"))
      (t (:inverse-video t)))
    "Face for highlighting Isearch matches."
    :group 'isearch-faces)
  (defvar isearch 'isearch)
  
  (defface isearch-lazy-highlight-face
!   '((((class color) (min-colors 88) (background light))
       (:background "paleturquoise"))
!     (((class color) (min-colors 88) (background dark))
       (:background "paleturquoise4"))
+     (((class color) (min-colors 16))
+      (:background "turquoise3"))
+     (((class color) (min-colors 8))
+      (:background "turquoise3"))
      (t (:underline t)))
    "Face for lazy highlighting of Isearch matches other than the current one."
    :group 'isearch-faces)

[-- Attachment #3: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2004-02-13 20:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-08  4:13 supporting more faces on 256 colors xterms Dan Nicolaescu
2004-02-08  6:08 ` Eli Zaretskii
2004-02-08  8:15   ` Dan Nicolaescu
2004-02-08 13:45     ` Andreas Schwab
2004-02-08 18:24       ` Eli Zaretskii
2004-02-08 19:11         ` Andreas Schwab
2004-02-08 23:19           ` Miles Bader
2004-02-08 23:52         ` Dan Nicolaescu
2004-02-09  6:03           ` Eli Zaretskii
2004-02-12 22:13             ` Dan Nicolaescu
2004-02-13  8:57               ` Eli Zaretskii
2004-02-13 20:29                 ` Dan Nicolaescu [this message]
2004-02-14 12:15                   ` Eli Zaretskii
2004-02-17 20:30                     ` Dan Nicolaescu
2004-02-13  9:02               ` Eli Zaretskii
2004-06-04 19:42               ` Juri Linkov
2004-06-04 21:14                 ` Dan Nicolaescu
2004-06-04 23:12                   ` Juri Linkov
2004-06-05 22:50                 ` Richard Stallman
2004-02-08 18:35     ` Eli Zaretskii
2004-02-09  9:38 ` Richard Stallman
2004-02-12 18:40   ` small grep.el fix Dan Nicolaescu
2004-02-15 13:13     ` Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200402132028.i1DKSwY7013278@scanner2.ics.uci.edu \
    --to=dann@ics.uci.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).