From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#25890: `color-values` gives wrong value Date: Fri, 3 Mar 2017 07:49:33 -0800 (PST) Message-ID: <2cfd6280-34de-4751-b35f-ec7d47a16595@default> References: <<87zih7n2yt.fsf@pank.eu>> <<83r32jpr8b.fsf@gnu.org>> <<87bmtnryqr.fsf@drachen>> <<87d1e2tzt5.fsf@pank.eu>> <<8337eypb5l.fsf@gnu.org>> <<87vartx4qd.fsf@drachen>> <<56bad9de-8111-4962-a9e9-2dbf0084e004@default>> <<83wpc6la28.fsf@gnu.org>> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1488556219 21591 195.159.176.226 (3 Mar 2017 15:50:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 3 Mar 2017 15:50:19 +0000 (UTC) Cc: michael_heerdegen@web.de, 25890@debbugs.gnu.org, rasmus@gmx.us To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 03 16:50:16 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 1cjpTB-0004yU-JL for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Mar 2017 16:50:13 +0100 Original-Received: from localhost ([::1]:58727 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjpTH-0005CD-PO for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Mar 2017 10:50:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjpT5-00057r-9N for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2017 10:50:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjpT0-0002U7-Dj for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2017 10:50:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40444) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjpT0-0002Tw-AU for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2017 10:50:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cjpT0-0000Kj-18 for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2017 10:50:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Mar 2017 15:50: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.14885561861256 (code B ref 25890); Fri, 03 Mar 2017 15:50:01 +0000 Original-Received: (at 25890) by debbugs.gnu.org; 3 Mar 2017 15:49:46 +0000 Original-Received: from localhost ([127.0.0.1]:38643 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjpSk-0000KC-5R for submit@debbugs.gnu.org; Fri, 03 Mar 2017 10:49:46 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:26345) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjpSi-0000Jz-LQ for 25890@debbugs.gnu.org; Fri, 03 Mar 2017 10:49:45 -0500 Original-Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v23FnbRT024764 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Mar 2017 15:49:38 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v23FnauV002176 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Mar 2017 15:49:37 GMT Original-Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v23FnZN0003788; Fri, 3 Mar 2017 15:49:35 GMT In-Reply-To: <<83wpc6la28.fsf@gnu.org>> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] X-Source-IP: userv0022.oracle.com [156.151.31.74] 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:130114 Archived-At: > > > > (defun color-rgb-to-hex (red green blue) > > > > The function should accept an optional arg NB-DIGITS, which > > specifies the number of hex digits for each of R, G, B. And > > yes, it should default to 4 digits: #RRRRGGGGBBBB. > > > > (That's what the original function in hexrgb.el does, from > > which color.el was supposedly derived.) >=20 > The code in hexrgb.el produces strange results in this regard (e.g., > it produces "#FFFFFFFFE0E0" instead of "#FFFFFFFFE000" for the color > mentioned by the OP). Not clear what you are saying. What color mentioned by the OP? Do you mean "light yellow"? What sexp using hexrgb.el did you try? =20 If I do (hexrgb-color-name-to-hex "light yellow") I do get "#FFFFFFFFE0E0". That comes from `x-color-values' returning (65535 65535 57568) and `hexrgb-int-to-hex' converting 57568 to "E0E0". That's from (format "%04X" 57568). Hex conversion of decimal 57568 _should_ be E0E0, AFAIK. Where is the bug? Or are you saying that the bug is from `x-color-values' (`color-values') and not from hexrgb.el? Is 57568 the wrong blue color value for "light yellow"? > I believe that's because it interprets the > conversion between 2 and 4 hex digits incorrectly: the 2 hex digits > are the _most_ significant bits of the 4-digit version, not the LSB. See above. I'm missing what you are trying to say, I guess. Are you saying that color value 57568 should not be expressed in hex as E0E0? > But I did add such an optional argument to color-rgb-to-hex, Good. > with the difference that its value can only be either 4 or 2, > as I see no reason for anyone to want a 12-bit per component > color notations. (I see no reason for the function not to be general. Sure, for current applications of such a function to colors there is no real need for such generality. But why prevent it?) Anyway, thanks for adding the optional arg. I'm interested in your reply to my questions above, especially in the case that might have located a bug in hexrgb.el. It's not clear to me, so far. Thx.