From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#25890: `color-values` gives wrong value Date: Wed, 01 Mar 2017 00:42:02 +0100 Message-ID: <87vartx4qd.fsf@drachen> References: <87zih7n2yt.fsf@pank.eu> <83r32jpr8b.fsf@gnu.org> <87bmtnryqr.fsf@drachen> <87d1e2tzt5.fsf@pank.eu> <8337eypb5l.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488325395 6844 195.159.176.226 (28 Feb 2017 23:43:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 28 Feb 2017 23:43:15 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 25890@debbugs.gnu.org, Rasmus To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Mar 01 00:43:10 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cirQC-00015q-Ib for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 Mar 2017 00:43:08 +0100 Original-Received: from localhost ([::1]:37683 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cirQG-0005nm-Kx for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Feb 2017 18:43:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cirQA-0005nS-09 for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2017 18:43:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cirQ6-0008RF-2d for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2017 18:43:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34264) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cirQ5-0008R9-Vi for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2017 18:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cirQ5-0003pD-QA for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2017 18:43:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Feb 2017 23:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25890 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25890-submit@debbugs.gnu.org id=B25890.148832533714652 (code B ref 25890); Tue, 28 Feb 2017 23:43:01 +0000 Original-Received: (at 25890) by debbugs.gnu.org; 28 Feb 2017 23:42:17 +0000 Original-Received: from localhost ([127.0.0.1]:60696 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cirPN-0003oF-8U for submit@debbugs.gnu.org; Tue, 28 Feb 2017 18:42:17 -0500 Original-Received: from mout.web.de ([212.227.17.11]:61350) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cirPL-0003o3-J9 for 25890@debbugs.gnu.org; Tue, 28 Feb 2017 18:42:16 -0500 Original-Received: from drachen.dragon ([109.43.0.139]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LcxtU-1c12D91xeC-00iFqC; Wed, 01 Mar 2017 00:42:07 +0100 In-Reply-To: <8337eypb5l.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 28 Feb 2017 17:50:30 +0200") X-Provags-ID: V03:K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Nu7pA3Ax/rEvuWbfWdUte7C X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:129966 Archived-At: Eli Zaretskii writes: > So I think the patch below is what is needed to fix this problem. Can > you try it? (There's one user of the functions the patch changes, > shr-color.el, which will need to be adapted to the change, if we > decide to install it.) > > > --- lisp/color.el~0 2017-01-02 06:25:09.000000000 +0200 > +++ lisp/color.el 2017-02-28 17:35:43.570586100 +0200 > @@ -52,14 +52,14 @@ > If FRAME cannot display COLOR, return nil." > ;; `colors-values' maximum value is either 65535 or 65280 depending on the > ;; display system. So we use a white conversion to get the max value. > - (let ((valmax (float (car (color-values "#ffffff"))))) > + (let ((valmax (float (car (color-values "#ffffffffffff"))))) > (mapcar (lambda (x) (/ x valmax)) (color-values color frame)))) > > (defun color-rgb-to-hex (red green blue) > "Return hexadecimal notation for the color RED GREEN BLUE. > RED, GREEN, and BLUE should be numbers between 0.0 and 1.0, inclusive." > - (format "#%02x%02x%02x" > - (* red 255) (* green 255) (* blue 255))) > + (format "#%04x%04x%04x" > + (* red 65535) (* green 65535) (* blue 65535))) > > (defun color-complement (color-name) > "Return the color that is the complement of COLOR-NAME. With that patch, for me in the recipe of bug #24273, it makes a difference; now (color-name-to-rgb "#ffffff") ==> (0.9961089494163424 0.9961089494163424 0.9961089494163424) and (color-name-to-rgb "white") ==> (1.0 1.0 1.0) For the recipe of this bug report, the values are the same as without the patch. I guess this is what you expected. But is it ok that "#ffffff" is not equivalent to "white"? If it is, seems there is no inconsistency left. Thanks so far, Michael.