emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: face colors on 256 colors terminals


From: Dan Nicolaescu
Subject: Re: face colors on 256 colors terminals
Date: Fri, 08 Apr 2005 08:13:08 -0700

"Eli Zaretskii" <address@hidden> writes:

  > > Cc: address@hidden
  > > From: Dan Nicolaescu <address@hidden>
  > > Date: Thu, 07 Apr 2005 18:17:48 -0700
  > > 
  > > James Cloos <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]