From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Rasmus Newsgroups: gmane.emacs.bugs Subject: bug#25890: `color-values` gives wrong value Date: Mon, 27 Feb 2017 18:09:46 +0100 Message-ID: <87lgsrmug5.fsf@gmx.us> References: <87zih7n2yt.fsf@pank.eu> <83r32jpr8b.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488216969 17534 195.159.176.226 (27 Feb 2017 17:36:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 27 Feb 2017 17:36:09 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: 25890@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 27 18:36:04 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 1ciPDI-0003eL-LJ for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Feb 2017 18:35:56 +0100 Original-Received: from localhost ([::1]:55091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciPDO-0000mQ-Ql for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Feb 2017 12:36:02 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciOpG-0005v7-Bj for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 12:11:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciOpC-0006QR-50 for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 12:11:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60351) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ciOpB-0006QE-T3 for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 12:11:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ciOpB-0001Nt-O8 for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 12:11:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87zih7n2yt.fsf@pank.eu> Resent-From: Rasmus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Feb 2017 17:11: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: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14882154165268 (code B ref -1); Mon, 27 Feb 2017 17:11:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Feb 2017 17:10:16 +0000 Original-Received: from localhost ([127.0.0.1]:58550 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciOoR-0001Mu-LE for submit@debbugs.gnu.org; Mon, 27 Feb 2017 12:10:15 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:39151) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciOoQ-0001Mi-BD for submit@debbugs.gnu.org; Mon, 27 Feb 2017 12:10:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciOoK-000605-9z for submit@debbugs.gnu.org; Mon, 27 Feb 2017 12:10:09 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:37093) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciOoK-0005zs-6r for submit@debbugs.gnu.org; Mon, 27 Feb 2017 12:10:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciOoI-00051u-VU for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 12:10:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciOoE-0005wC-Tu for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 12:10:06 -0500 Original-Received: from [195.159.176.226] (port=35189 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ciOoE-0005vL-NJ for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 12:10:02 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1ciOo5-0005pg-T9 for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 18:09:53 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 73 Original-X-Complaints-To: usenet@blaine.gmane.org Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAtCAMAAADflBjwAAAATlBMVEUAAAAAAgAQAgAMAPsU FwAVIAAANAAwMQD7AADBIABOTwASYwBucACObQCKdwCCgQF1iwBomgBLqgAdvwCZmGcK3ACwsEYF /QC/wk/s7QDaAG5EAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAewQAAHsEBw2lUUwAAAg1JREFUSMe1 ldG2oyAMRY1FpaCAUG5u//9HJwHUVsVxHiartaySDYckxKbZDNjyE5o7BqDUQF+l7gLCWgWW7PYO xZi74/9+v2F88/M28EvAz+/PfeBBwOPx+I/Ai4DX68UA/Ouh4V5M2RNKKi4TTkke2azNTwL4j/pG Qij7bb1iWghRq4lPM9ZOqJMyO5zsAbvFHVqPZJC02SMB4zjwWnk+OIch/g3gTfK8wdlhtjpgTBZu DIaJPFvoPwAr9giQABNwipG8I+oOYnCoe3QXgAtIShzGGHtoMbpIwOwqAG7mKb2tZT2BHrECkOQs yXA50Ig5RSeqAp0ftH4aLgVQEYPWDegQakApPCkl/xg6EXebC0lkLTylbKlOQ4onL6IMcqjP8sDT 5B+di7R61/cpcjHO1laBVsones9RzbegJT1pfaqCM0DKOVdD8qbUU6BMtVqbctxyw0Awai707ACl SE7Ies67h0yf9XIYt8TTHvXDxuSEaJYzmSwIjimG75s6jm5GX8JJCVscygB2EkE4Mlz8x484FGDX EaFLeor/sDaBtVHtXgOQLvIaz7XvLBeP7RvwIdDtL8Cwum0jq77SCKMxxi/AwWhyF7YiaTrzpgOU Kj4CS5GGuO41djStUxWfAOg5uI5uhnV5lBN+0svp9k/TtHQxgG1U7fpt3gEFwPYavnyrBO+DVgHu Ajd8/gAFdzaQIg/inAAAAABJRU5ErkJggg== Cancel-Lock: sha1:k2zDYuei1GBS7D8dtJThJTJKP3E= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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:129888 Archived-At: Hi Eli, Eli Zaretskii writes: >> I try to get the color value of my background, "light yellow", with >> color.el. However, `color-values` from faces.el returns the wrong value. >> >> (color-values "#ffffff") => (65280 65280 65280) ; The max values. > > Are you sure? > > What does the below produce? > > (color-values "#fffffffff") For that I get the right value: (color-values "#fffffffff") => (65520 65520 65520) (color-values "#ffffff") => (65280 65280 65280) >> (color-values "#ffffe0") => (65280 65280 57344) ; Light yellow hex. >> (color-values "light yellow") => (65535 65535 57568) ; The potential bug. > > On my system, I get these results: > > (color-values "#ffffff") => (65535 65535 65535) > (color-values "#ffffe0") => (65535 65535 57568) > (color-values "light yellow") => (65535 65535 57568) Which seems more reasonable. >> That is the color value of "light yellow" exceeds the maximum value as >> defined by the color values of white (cf. `color-rgb-to-hex'). This means >> that the color.el functions won't work. > > I think this means your color resolution is greater than 24 bits. Xorg tells me it's using 24 bits. $> xwininfo -root | grep Depth Depth: 24 > Or maybe I don't understand how the above affects your code. I want to manipulate colors such as "light yellow" with color.el. E.g. (set-frame-parameter (selected-frame) 'background-color (color-darken-name "light yellow" 5)) This produces an "Undefined color" error because (color-darken-name "light yellow" 5) => "#100100c6". This in turn points to `color-name-to-rgb', which uses (color-values "#ffffff") as the denominator. Because "#ffffff produces an RGB triplet with smaller numbers than "light yellow", I get an RGB triple with elements exceeding 1, which it shouldn't. So an easy fix might be to use "#fffffffff" in `color-name-to-rgb', but then I'd still not have equal color values for the white with and without alpha... (equal (color-values "#fffffffff") (color-values "#ffffff")) => nil Thus, I suggested that the error was in the C code in my initial report. I hope this explains the problem I'm seeing better. Thanks, Rasmus -- Even a three-legged dog has three good legs to lose