From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: Re: face colors on 256 colors terminals Date: Fri, 08 Apr 2005 08:13:08 -0700 Message-ID: <200504081513.j38FDBAH019262@scanner2.ics.uci.edu> References: <200504060817.j368HDAH019106@scanner2.ics.uci.edu> <01c53acd$Blat.v2.4$7c0f2080@zahav.net.il> <200504080117.j381HoAH023607@scanner2.ics.uci.edu> <01c53c29$Blat.v2.4$35996c20@zahav.net.il> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1112973551 1204 80.91.229.2 (8 Apr 2005 15:19:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 8 Apr 2005 15:19:11 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 08 17:19:08 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DJvEb-0004vP-NF for ged-emacs-devel@m.gmane.org; Fri, 08 Apr 2005 17:17:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DJuo7-0007Cx-Ej for ged-emacs-devel@m.gmane.org; Fri, 08 Apr 2005 10:50:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DJukZ-00064P-25 for emacs-devel@gnu.org; Fri, 08 Apr 2005 10:46:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DJukQ-00060k-2D for emacs-devel@gnu.org; Fri, 08 Apr 2005 10:46:15 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DJukP-0005pP-F6 for emacs-devel@gnu.org; Fri, 08 Apr 2005 10:46:13 -0400 Original-Received: from [128.195.1.36] (helo=scanner2.ics.uci.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DJvE4-0007CU-4r; Fri, 08 Apr 2005 11:16:52 -0400 Original-Received: from vino.ics.uci.edu (dann@vino.ics.uci.edu [128.195.11.198]) by scanner2.ics.uci.edu (8.12.10/8.12.10) with ESMTP id j38FDBAH019262; Fri, 8 Apr 2005 08:13:11 -0700 (PDT) Original-To: Eli Zaretskii In-Reply-To: <01c53c29$Blat.v2.4$35996c20@zahav.net.il> (Eli Zaretskii's message of "Fri, 08 Apr 2005 13:52:31 +0300") Original-Lines: 110 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=-98.3, required 5, FM_MULTI_ODD2, J_CHICKENPOX_52, USER_IN_WHITELIST) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:35768 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:35768 "Eli Zaretskii" writes: > > Cc: eliz@gnu.org > > From: Dan Nicolaescu > > Date: Thu, 07 Apr 2005 18:17:48 -0700 > > > > James Cloos 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)))))