From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#25890: `color-values` gives wrong value Date: Sat, 04 Mar 2017 16:38:09 +0200 Message-ID: <83shmtjeem.fsf@gnu.org> References: <87zih7n2yt.fsf@pank.eu> <83r32jpr8b.fsf@gnu.org> <87bmtnryqr.fsf@drachen> <87d1e2tzt5.fsf@pank.eu> <8337eypb5l.fsf@gnu.org> <87r32hs4mt.fsf@gmx.us> <1488637440.20657.0@smtp.gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1488638352 24918 195.159.176.226 (4 Mar 2017 14:39:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 4 Mar 2017 14:39:12 +0000 (UTC) Cc: 25890@debbugs.gnu.org, rasmus@gmx.us To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 04 15:39:08 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 1ckApu-0005lQ-KC for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Mar 2017 15:39:06 +0100 Original-Received: from localhost ([::1]:35584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckAq0-0006kp-L9 for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Mar 2017 09:39:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckApt-0006kY-6h for bug-gnu-emacs@gnu.org; Sat, 04 Mar 2017 09:39:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ckApq-0000d5-04 for bug-gnu-emacs@gnu.org; Sat, 04 Mar 2017 09:39:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41106) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ckApp-0000cr-Ty for bug-gnu-emacs@gnu.org; Sat, 04 Mar 2017 09:39:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ckApp-00065E-NA for bug-gnu-emacs@gnu.org; Sat, 04 Mar 2017 09:39:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Mar 2017 14:39: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.148863831723342 (code B ref 25890); Sat, 04 Mar 2017 14:39:01 +0000 Original-Received: (at 25890) by debbugs.gnu.org; 4 Mar 2017 14:38:37 +0000 Original-Received: from localhost ([127.0.0.1]:39305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ckApR-00064Q-Bz for submit@debbugs.gnu.org; Sat, 04 Mar 2017 09:38:37 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:58340) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ckApP-00064E-JF for 25890@debbugs.gnu.org; Sat, 04 Mar 2017 09:38:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ckApJ-0000Vj-An for 25890@debbugs.gnu.org; Sat, 04 Mar 2017 09:38:30 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckApD-0000R3-OY; Sat, 04 Mar 2017 09:38:23 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4211 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ckApC-0004xA-P1; Sat, 04 Mar 2017 09:38:23 -0500 In-reply-to: <1488637440.20657.0@smtp.gmail.com> (message from Simen =?UTF-8?Q?Heggest=C3=B8yl?= on Sat, 04 Mar 2017 15:24:00 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:130181 Archived-At: > Date: Sat, 04 Mar 2017 15:24:00 +0100 > From: Simen Heggestøyl > Cc: 25890-done@debbugs.gnu.org > > Thanks, Eli. The changes makes sense to me, but I've still got one > problem. I'm working with web colors, where color codes are specified > with either one or two digits per component (meaning that both "#fff" > and "#ffffff" specify the brightest possible value, named > "white"). But: > > (apply #'color-rgb-to-hex `(,@(color-name-to-rgb "#ffffff") 2)) > => "#fefefe" > > (apply #'color-rgb-to-hex `(,@(color-name-to-rgb "#fff") 2)) > => "#efefef" > > Where I would like both to give back "#ffffff". Does this mean that I > have to ensure that input to `color-name-to-rgb' uses 4 digits per > component? Yes, IMO. Emacs does all its calculations with color components assuming 16 bits per component. Applications that need to use fewer digits and have the missing digits as something other than zero, need to do that in application code. > Would it make sense for it to get a new optional parameter > `DIGITS-PER-COMPONENT', like `color-rgb-to-hex' did? Not IMO, because only the application knows what it means by #ffffff, color.el has no way of knowing that. So it would be best to leave this for the application to do, by converting the #RGB spec to the canonical 16-bits-per-component form.