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: face colors on 256 colors terminals
Date: Fri, 08 Apr 2005 08:13:08 -0700	[thread overview]
Message-ID: <200504081513.j38FDBAH019262@scanner2.ics.uci.edu> (raw)
In-Reply-To: <01c53c29$Blat.v2.4$35996c20@zahav.net.il> (Eli Zaretskii's message of "Fri, 08 Apr 2005 13:52:31 +0300")

"Eli Zaretskii" <eliz@gnu.org> writes:

  > > Cc: eliz@gnu.org
  > > From: Dan Nicolaescu <dann@ics.uci.edu>
  > > Date: Thu, 07 Apr 2005 18:17:48 -0700
  > > 
  > > James Cloos <cloos@jhcloos.com> writes:
  > > 
  > >   > I beleive I recall this coming up on the xfree lists some years back,
  > >   > and further beleive that the current codebase of both xfree and xorg
  > >   > do in fact scale the way David recomends.
  > >   > 
  > >   > It is likely that only the docs are out of date.
  > >   > 
  > >   > It is certainly the case that the colours named by xmag(1x) when you
  > >   > click on a pixel in its window show the replicated pattern, and I tend
  > >   > to use the #rrggbb convention for specifying colours....
  > > 
  > > Great! Thanks, I think this is the info we needed.
  > > I tried xmag on both solaris2.8 and Fedora Core 3 and indeed it seems
  > > that the conversion it uses is Y -> YY (where Y is 8bit).
  > > Eli, do you agree to go this way? 
  > 
  > I'd prefer not to make such a significant change in
  > tty-color-standard-values before the release.  The current scheme
  > worked well for several 21.x releases, and I don't think we should
  > make radical changes in it now, before we've seen the 256-color xterm
  > support in a released Emacs.  Let's wait until after the release.
  > 
  > But I think the info above means that we should leave
  > color-name-rgb-alist alone, since it already uses the scheme James
  > says is now standard in X, and changing it now just to change it back
  > for the next release sounds silly.

OK. 

What about the xterm.el patch for xterm-register-default-colors and
xterm-rgb-convert-to-16bit?
I have verified that after this patch the color values produced by
xterm-register-default-colors are exactly the same
as the color values produced by xterm-200/256colres.pl and
xterm-200/88colres.pl (well, the corresponding 8bit version). 
[This patch actually improves the color display and fixes the
non-linearity problem in the gray scale].
 

Index: lisp/term/xterm.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/term/xterm.el,v
retrieving revision 1.11
diff -c -3 -p -r1.11 xterm.el
*** lisp/term/xterm.el	6 Apr 2005 21:38:34 -0000	1.11
--- lisp/term/xterm.el	8 Apr 2005 15:08:14 -0000
***************
*** 123,129 ****
  
  (defun xterm-rgb-convert-to-16bit (prim)
    "Convert an 8-bit primary color value PRIM to a corresponding 16-bit value."
!   (min 65535 (round (* (/ prim 255.0) 65535.0))))
  
  (defun xterm-register-default-colors ()
    "Register the default set of colors for xterm or compatible emulator.
--- 123,129 ----
  
  (defun xterm-rgb-convert-to-16bit (prim)
    "Convert an 8-bit primary color value PRIM to a corresponding 16-bit value."
!   (logior prim (lsh prim 8)))
  
  (defun xterm-register-default-colors ()
    "Register the default set of colors for xterm or compatible emulator.
*************** versions of xterm."
*** 160,168 ****
  	    (tty-color-define (format "color-%d" (- 256 ncolors))
  			      (- 256 ncolors)
  			      (mapcar 'xterm-rgb-convert-to-16bit
! 				      (list (round (* r 42.5))
! 					    (round (* g 42.5))
! 					    (round (* b 42.5)))))
  	    (setq b (1+ b))
  	    (if (> b 5)
  		(setq g (1+ g)
--- 160,169 ----
  	    (tty-color-define (format "color-%d" (- 256 ncolors))
  			      (- 256 ncolors)
  			      (mapcar 'xterm-rgb-convert-to-16bit
! 				      (list (if (zerop r) 0 (+ (* r 40) 55))
! 					    (if (zerop g) 0 (+ (* g 40) 55))
! 					    (if (zerop b) 0 (+ (* b 40) 55)))))
! 
  	    (setq b (1+ b))
  	    (if (> b 5)
  		(setq g (1+ g)
*************** versions of xterm."
*** 200,206 ****
  	;; Now the 8 gray colors
  	(while (> ncolors 0)
  	  (setq color (xterm-rgb-convert-to-16bit
! 		       (round
  			(if (= ncolors 8)
  			    46.36363636
  			  (+ (* (- 8 ncolors) 23.18181818) 69.54545454)))))
--- 201,207 ----
  	;; Now the 8 gray colors
  	(while (> ncolors 0)
  	  (setq color (xterm-rgb-convert-to-16bit
! 		       (floor
  			(if (= ncolors 8)
  			    46.36363636
  			  (+ (* (- 8 ncolors) 23.18181818) 69.54545454)))))

  reply	other threads:[~2005-04-08 15:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-06  8:17 face colors on 256 colors terminals Dan Nicolaescu
2005-04-06 17:23 ` Eli Zaretskii
2005-04-06 17:36   ` David Kastrup
2005-04-06 17:46     ` Eli Zaretskii
2005-04-06 18:03       ` David Kastrup
2005-04-06 18:26     ` Dan Nicolaescu
2005-04-07 20:43     ` James Cloos
2005-04-08  1:17       ` Dan Nicolaescu
2005-04-08 10:52         ` Eli Zaretskii
2005-04-08 15:13           ` Dan Nicolaescu [this message]
2005-04-09  8:06             ` Eli Zaretskii
2005-04-06 17:52   ` Dan Nicolaescu
     [not found]     ` <01c53aea$Blat.v2.4$16ee4740@zahav.net.il>
2005-04-06 23:50       ` Dan Nicolaescu
2005-04-07  0:22         ` David Kastrup
2005-04-07  3:58           ` Eli Zaretskii
2005-04-07  5:14           ` Dan Nicolaescu
2005-04-07 10:23             ` David Kastrup
2005-04-08  1:13               ` Dan Nicolaescu
2005-04-07  3:55         ` Eli Zaretskii
     [not found]   ` <200504062134.j36LY8AH022227@scanner2.ics.uci.edu>
2005-04-07  3:53     ` Eli Zaretskii
2005-04-07 18:27       ` Dan Nicolaescu
2005-04-08 10:54         ` Eli Zaretskii

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=200504081513.j38FDBAH019262@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).