GNU bug report logs - #41544
26.3; Possible incorrect results from color-distance

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Simon Pugnet <simon@HIDDEN>; Keywords: patch; dated Tue, 26 May 2020 16:34:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 7 Jun 2020 19:27:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 07 15:27:57 2020
Received: from localhost ([127.0.0.1]:54950 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ji0xZ-0000bC-4Z
	for submit <at> debbugs.gnu.org; Sun, 07 Jun 2020 15:27:57 -0400
Received: from mail1477c50.megamailservers.eu ([91.136.14.77]:54790
 helo=mail118c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1ji0xW-0000av-Fj
 for 41544 <at> debbugs.gnu.org; Sun, 07 Jun 2020 15:27:55 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591558066;
 bh=ptgpP/XtKhWA2M3Jo+MgZGyczWxIcmObjGIaT1a9R50=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=Z7tjN4NTnw0yYJ4Zjx6e1+ICeWmInIIrqOX7FyHmUHcrp/SLf4oAnC+/sHw76OV0R
 b22O9jp5A2cwXYrDeheZuIrflNW8tJgwHiKHJ3ojR+26mWrTSl1vZGMhepCgIEuHB/
 NETKJn8MniKgxgqZ89R9zF73qjfFG4WCzHXAlWj0=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail118c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 057JRibv011181; 
 Sun, 7 Jun 2020 19:27:45 +0000
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <87d06ar87d.fsf@simenheg@HIDDEN>
Date: Sun, 7 Jun 2020 21:27:43 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <52B0E3DA-6CE4-47D3-8243-6E2C2F64D7BD@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN> <83y2p5cumz.fsf@HIDDEN>
 <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN> <83blm0cjlz.fsf@HIDDEN>
 <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN> <83367ccf8w.fsf@HIDDEN>
 <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN> <83o8pyc4bq.fsf@HIDDEN>
 <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN> <835zc5bsut.fsf@HIDDEN>
 <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN> <838sh0abzz.fsf@HIDDEN>
 <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN> <83r1us8kw6.fsf@HIDDEN>
 <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN> <83img48ffx.fsf@HIDDEN>
 <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN> <83bllw82xt.fsf@HIDDEN>
 <87pnabfdr5.fsf@simenheg@HIDDEN>
 <2F9BF919-4E8B-4802-AEE8-4438A78B4F68@HIDDEN>
 <87d06ar87d.fsf@simenheg@HIDDEN>
To: =?utf-8?Q?Simen_Heggest=C3=B8yl?= <simenheg@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F27.5EDD3F51.002B:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=KaGsTjQD c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=IkcTkHD0fZMA:10 a=M51BFTxLslgA:10
 a=7DrQrguiAAAA:8 a=LnkmoK0KZgWA8aYg0TwA:9 a=QEXdDO2ut3YA:10
 a=5p0t1moz68ydotlU2Z85:22
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 41544
Cc: Richard Copley <rcopley@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

7 juni 2020 kl. 21.23 skrev Simen Heggest=C3=B8yl <simenheg@HIDDEN>:

>> Perhaps you could try list-colours-display and see if you can spot a
>> pattern?
>=20
> Hm, that one seems to use a black foreground color for all of the
> entries(?).

Yes, but with the patch posted, it should be using color-dark-p. Please =
give it a go.

(An updated patch as well as a longer discussion of the principles is =
upcoming; a bit busy with other things at the moment.)





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 7 Jun 2020 19:26:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 07 15:26:55 2020
Received: from localhost ([127.0.0.1]:54946 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ji0wY-0000ZW-RH
	for submit <at> debbugs.gnu.org; Sun, 07 Jun 2020 15:26:55 -0400
Received: from aibo.runbox.com ([91.220.196.211]:46380)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <simenheg@HIDDEN>) id 1ji0wX-0000ZO-1V
 for 41544 <at> debbugs.gnu.org; Sun, 07 Jun 2020 15:26:53 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; 
 s=selector1;
 h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From;
 bh=bDI84Ln3VUbcEABgectFB1VNOnv2Z9TBaOp4xXObZCY=; b=TmoKYl+i8IGqUvDfyB8qMBBg8d
 abpp4ENlf5iEpph/RvmeDxHn+fnHoE7wy4vj2l61Uen7PiAykxwJcBAsdCMw6Mlvp5bDJhh8kfD4O
 wfaaX1fLSupZiNF+tZucxgphkmmqUt4y50HgDjKsvDejh7Un7w192qCOs8sRGPd2xLlXmR7iF73Ca
 HBkqTNGJRUFEUcgkRIDpo+m97HBrdgHLJ2679xWXB4qO/Xy0JHR6UhSLN9BEwcrDMDCOPTxCVhxfX
 7BqCaPuDQw2O/L1xQWDALZ+E5myf+0O4ti1EvB/uISrfe6RKmD/KwjbO+YCzsFPyV/N7y4R5dDHwR
 ONjonz7Q==;
Received: from [10.9.9.73] (helo=submission02.runbox)
 by mailtransmit02.runbox with esmtp (Exim 4.86_2)
 (envelope-from <simenheg@HIDDEN>)
 id 1ji0wW-0006CF-D8; Sun, 07 Jun 2020 21:26:52 +0200
Received: by submission02.runbox with esmtpsa [Authenticated alias (963757)]
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1)
 id 1ji0wU-0001Xg-H5; Sun, 07 Jun 2020 21:26:50 +0200
From: =?utf-8?Q?Simen_Heggest=C3=B8yl?= <simenheg@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN>
 <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN>
 <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN>
 <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN>
 <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN>
 <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN>
 <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
 <83r1us8kw6.fsf@HIDDEN>
 <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN>
 <83img48ffx.fsf@HIDDEN>
 <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN>
 <83bllw82xt.fsf@HIDDEN> <87pnabfdr5.fsf@simenheg@HIDDEN>
 <831rmr7xzz.fsf@HIDDEN>
Date: Sun, 07 Jun 2020 21:26:50 +0200
In-Reply-To: <831rmr7xzz.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 07 Jun
 2020 17:26:40 +0300")
Message-ID: <878sgyr81x.fsf@simenheg@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 41544
Cc: rcopley@HIDDEN, mattiase@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

--=-=-=
Content-Type: text/plain

Eli Zaretskii <eliz@HIDDEN> writes:

> We can (and did) tweak the various constants involved in this, more
> than once.  The lesson I took from that is that we could never produce
> something that will fit all the needs, let alone satisfy all the
> users.  There are two main factors here on which we have no control:
> the subjective differences between color perception by different
> people, and variations in how different terminals and displays show
> the same colors.
>
> That is why I object to making changes in this low-level functionality
> with the motivation of "fixing them all": I think it's simply
> impossible.  We will make it slightly better in some situations and
> slightly worse in others.  There's no net win here.

Maybe the ultimate fix in CSS mode's case could be to display the color
separate from the text. Firefox, for instance, displays the color in a
little circle next to the color code (screenshot attached). I'm not sure
how to implement it in Emacs, though.

-- Simen


--=-=-=
Content-Type: image/png
Content-Disposition: attachment; filename=firefox-color-indicator.png
Content-Transfer-Encoding: base64

iVBORw0KGgoAAAANSUhEUgAAAOMAAABVCAYAAAC7HVMkAAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9
kT1Iw0AcxV9btSIVkXYQcchQnSyIiuimVShChVArtOpgcukXNGlIUlwcBdeCgx+LVQcXZ10dXAVB
8APEydFJ0UVK/F9SaBHjwXE/3t173L0D/PUyU82OMUDVLCOViAuZ7KoQfEUXggijHzMSM/U5UUzC
c3zdw8fXuxjP8j735+hVciYDfALxLNMNi3iDeGrT0jnvE0dYUVKIz4lHDbog8SPXZZffOBcc9vPM
iJFOzRNHiIVCG8ttzIqGSjxJHFVUjfL9GZcVzluc1XKVNe/JXxjKaSvLXKc5hAQWsQQRAmRUUUIZ
FmK0aqSYSNF+3MM/6PhFcsnkKoGRYwEVqJAcP/gf/O7WzE+Mu0mhOND5Ytsfw0BwF2jUbPv72LYb
J0DgGbjSWv5KHZj+JL3W0qJHQN82cHHd0uQ94HIHGHjSJUNypABNfz4PvJ/RN2WB8C3Qs+b21tzH
6QOQpq6SN8DBITBSoOx1j3d3t/f275lmfz9yqXKnFTq0VAAAAAZiS0dEAP0A+AC5QI0G0wAAAAlw
SFlzAAAuIwAALiMBeKU/dgAAAAd0SU1FB+QGBxMUJ8ZSQToAAAAZdEVYdENvbW1lbnQAQ3JlYXRl
ZCB3aXRoIEdJTVBXgQ4XAAATjklEQVR42u2deXhU1d3HP7NkZpJJZpJM9klCQAIiSyCANBokENBa
taKIoFQNIq+K+tZWWiouxYqK4NZqi6WIlVdtQZuCEhZBESEKKJtAQVkCIZMEsk9m3+77x5AJ0wTI
BiHhfJ4nT+bOnPO75557v/ec8zubTJIkCYFA0OnIRRYIBEKMAoFAiFEgEGIUCARCjAKBEKNAIBBi
FAiEGAUCgRBj18dsNmM2m0VGCDEKOpsNG75gw4YvREYIMbaPTz5ZRVbWdYG/J598RuTyJc7mzVvI
y3uAnJxxTJlyn8iQTkLZ0QavuSaLP//5jwDMnv1st3tojxwpIi/vng6163Q6qaysChy73S4ATKbS
wHcxMQbUanWHX5PT6eT3v3+e+Pg4nnnmSRITE4UquosYY2IMxMQYAFCpQrqZGAtZv/7zDhOj0+lk
9eq1mEymZn//979XBB0bjUZ+9rOfdqgojx07jt1uZ+LEO8jNHSMUIdqMlycFBWvOKsTmMJlMrF69
tkPTYLPZANDrdeKGdKWSsbS0jLffXsT27d9hs9lIS+vB1Kn3MXr0qDYnoCU27777XlJTU6ioqKSo
6BjTpuUhlytYvHgJRmMS8+e/SEJCQqtsVlVVcfPNtzF9+jQcDgerV6/FbrczZEgGs2fPIjo6GoCS
khImTrw7KM1ZWdcFPk+blscDD9zf6us2m82Ulpa2Op7JZMLpdHZY6dgwg04mkwk1dBUxlpaWMW3a
/6BUKpk06Q50Oh1ffbWF2bOfYe7cOW2q4rTG5tat25kx40E2btzEwoWL6Nu3D4888hALFy7ivffe
Z9asmW1K50cffczIkdnMmzeXEydKmD//VRYseI2XXpoLQGxsbKAN/P77/2DHjp28/vqCQPzExIQ2
ZbzZXB90/OijM84Z/q23/hL4XFFRSXKysUMeAJ/P568iyYUYu4wY33jjTbxeL0uXvktsbAwAEybc
xkMPPcrbb/+tTWJsjc3hw4dy5513kJxs5IknZjF58p2MG5fL99/v5dChw21Op8FgYPbsWQAMGNCf
vXv3sXLlp7jdbkJCQlCr1WRmDgFg7drPkMvlgePuQFWV33EUEREh1NAV2ox2u52vv/6G664biU6n
w+l0Bf6uueYnlJSYgryBF8JmVFQUAJGRkQBER/uPdTpdoIO8LekcPnxY0HGPHqn4fL7AQ9pdcTpd
FBUdY9myjwkPD6dfv35CDV2hZCwrK8fr9VJQsIaCgjXNhqmrqw14US+ETYVC4U+wUtnkv8fjaXM6
G8TdQEiICgCr1dbhmW02m/n8840AuFzONtspLCxEpfK3GXNzR6PTtd75MnnyFMrLTxIWFsb8+S8S
FhYq1NAVxNjQyL/99vHceOMNzYYxGlvXhulImw222mLzYvstGtPaHhuNdtrKvHkvUFx8gkWLFjNn
zvMsX/4hoaFCkJe8GBMTE5HL5bhcLgYM6N9y48oQvF5vh9q8EOlsKe31OOp0Om6/fTwAJSUmVqxY
2SY72dnXttuB07dvH/r27YPb7eb5519k377/MHz4UKGIS73NGBYWyogRV7N+/QZKSkqa/F5aWtZs
vISEOE6cONGhNi9EOluKVhuGw+HAarV2mwcgPj4OAIvFItTQFUpGgMcff4zp0x8iL28648f/nORk
IxUVFezatRuLxcrSpUuaxBk7NpcFC15j3rwFZGQMQiaTccMN4wIlTFtsXoh0tpSMjAz+8Y/lvPDC
PK6/fhxqtZqUFCPJycld9gFouBdixc4uJMbU1BTefXcxixcvYc2addTV1WEwGOjXry+TJt3ZbJxb
b72FkydPUVCwhpUrPwVg3LjcgDOmLTYvRDpbyqhRI5k69T5WrSrgyy+/QpKkNnf663TBXQln9iOe
j4Yum46g4V64XC6hhs5+MYpFjDuP/PwVrR6Fk5SUFGh3dgQnT55i/Pg7uO66bGbO/BV6vR6VSiVu
jhDj5YXT6aSgYE2LBZmUlMRNN93Y4bM3XnnldfLzVyBJEj17pvHhh0vFzRFivHxFWVFRGTjesqUQ
8HtNz6yaXogpVA1YLBbKysqRyWT07n2FuCmXcptRcOFQq9VBXRUN1cSOGn/aEsLDw0lP7y1uRici
plAJBKKaKjgbDWNt2zLMTSDEKBAIRDVVIBBiFAgEQowCQfdDdG10Q5xOJ1VVVVRXVzf5TavVYjAY
hHPoEkQ4cLqZCIuLizl16tR5w6rVatLT09Hr9SLjhBg7l+TnKzCZfYHjvU8YGJDQdSsKVquVvXv3
BuaP9uxdiC5qE8qQ/SA7DlIPPO7+mGtGUXS4cWRPamoqKSkpFzRtnmIblTN24NhSia/OjebaGJK2
jLloNs0LD1P76g94jtnAK5G4fhShY+NFNfVS4aN7I3F6JAoOOHllk61LX8uZQkxI+hFj2nN+AQa9
do+jVB0nOn410XE9MB37PeWlfSguLsbj8dCzZ89WndO88DDVT+0lreo28EoU6fOJeTOTiPub2ql8
eAeObVVEvzAQRbwGRUzjQPTKR3di/vPhs54ndtEwIqb3apXNoNrCt9VUztiJdlIK0XMHIlPKUQ0K
XmrFU2Sl8vFd2DeeQiaXEXp9PDGvD0FhDF75QLJ6qJ69F8uyYnxmD+rMKKJfHoTm2hghxvaQ1cO/
2vnhSm+Xvg6v1xsQYs/eW4iO/10L6kPHMfa8n9CweRQdzqa0tBS9Xh9YK7YlOL6uQv0TA8jAuacW
yeZFk9X8Gkj2jafQTe+F7pGmw+20tyShSNA0+d620oRzRw2hufGtthkU7gt/lT124VDkUU0F66tx
UZqzEZ/ZTeRvrgSPj9rXf6T0+y9J3nk9sjBFIOzJyd9gKyhDN6M3Ib201C08Qtm4TRi3j0U1QC/E
eLljMpkCJWKLhHgG0fG/w25bQnlpH44ePdpKMVYSkdcz8FkerSLkyqZOIZ/ZjWT3NisEgNAbEgi9
4b/WnvVJ1P/tKJqRsSh7aVttM+hlddIBcNawdW8ewlNsI+HTbMJuTgIgpJ+OU3dtxbz4KPr/Tfdf
41cV2FaVoX+iL4ZXMvwvkgkpFPdZTc2z+4jPv/byEmP+Xievf2Vld6kHhRwyEpU8MUrLz/s3zmZw
emDOZxY+3GWnzOzDqFdw3zANT48NR9nGjpySOh+zCupZe9CJ1SXRL17JrNFaJg9u+kZ/q9DGYyvq
2T/TwN+/tfPBLgdVVh9p0Qo+nBJJprFjs7xh+pUx7bk2xTemPUd56Qc4nU6qq6vPKUjJ4kHySPiq
nHiOWlH11+GrdePYXIE6MwpfnRuZSo4sTEHlQzsw//VIIG7Nc/upeW4/wHnbjPYNJ/EU24h6Nngd
o5ba9JY7OJ74SVDco7Llgc9nthmtK0woEjSE3ZQU+D38jhQqHvwOa35JQIzWFf5tGHQPNFaZlT3C
CBsbj21NGZLDi0yjCDrnvn37+fjjfJKTjS2agN5lxDh/o5VZqy1kGpU8laslNETG1mI3bxbagsR4
7z/rWL7HwS8yNWT1CGHTUTfPrbdSUudj8cTWu/MtTomchdWY6rw8PlJLok7OBzsd3PVBHW4v3DNU
02y8X66sx+WRePHGCPQaGet/dFJh8TUJN2nSFIqLT/DaawvIyhrRqrRVV1cHqqdN2ogtduEdp2fv
LRQdzqaqquqcYiy7eTOOTRWN1bYJXwf9fizq32gnJBP/8TXof92H8Mkp+Cweym/ZQvh9aejy0vyl
lP7cJZr5nSJkoQq0E4OXM2mpTUW0iqSNOf6S763DWP9VEjgGUGWcbjN6JVz7zYSOiYMz1xpTylAP
jMS1pzbwlWtPLbJQBSF9g1doUA2JxLa6DPcP9Y12G/KrrJx169Zz1VX9uo8YT9T6eGqthZwrVHw2
PYqQ0y+gXwKlZ3hEd5k8LN/jYNrVoQHhzbjGn8/vbLcza7SW9BhFq879t212jlR5+b+79Pwi0y+8
6SPCuGpBJU+tqWdKpobmVsa3uiQ2z4hGcbo0Hj+g4+ciNiwipYva1C47/vjZOByOc4aLeWMIvlqX
3zNZbCPmj0NwH7dRkbed2EXDCEkPRx7rz6OQPhGE9InAV+v2H6dp0eTEnTctvmoX1pUmwickI9cF
72LWYpsqeeD7hhKtuXDeKhe4fCjiNUhOH6YR65FplRi/GoMiXo2v0B0o8TxldhRxapBBxYPfYVtV
inFLLop4//V6yxyQcRlUU1fud+DxwZNjtAEhNpCka6x7bjjkXxh46vBgL1je8FCW7XHw+SEX6TGt
Wxt0wyEnoUqYlNFYAoaGwKTBGl7eaOXHCi9XxjUV+GPXhgWEeC5GjsymsrKyXevaKEP+076H4HT8
821drhrsf/O7Z+xAOz4ZTU4c7sVHkemUREztCcr2L0Jb/8FxcPqIuDftgj9XktPvvJOp5fjMblz7
zchC5Eh2LzK1/55Kdr8YJacPmdp/Q51bq/CWOnAXWQPf+exNHYHjxuUyblxu9xLjkSr/hV4Vrzxv
2w6gR1SwONJOH5fUtd5zWlLnI0mvaPISONNmc2LsE9uyrH300Yfbn0FtraK2Ir5k9SC5JbynHLgP
1KN5KRpfrRvbZ+VosmLwWTzIQmTItO17pOqXFKFI0lyUfsCA4Jw+FLFqkreNBbUCWbiyUaihioBg
JZv/u4RVI/EcsaDJicO1v85fTQ5VtDs9XUKMDcMSZG0MJ7Xz3M2d93w29ZqLuFS5lAqy4vbFp3Gl
uOYov3UL9s8bR/aUjy9s0l4MuymRhFUj25wM184aXLtrifztlaC48PmnMKggRBbwuKoyo87wwjqR
60MCThllYiiOb6pAAmVKGMqUsCBvbXPdM62lSwwUv8Lgz5B95Z5zhkuJ9F/OsZrgEvD46eNkfdOH
TXW6auXxnd2mqc6L+78K1XPZvNh43P07JL5Wqz1rGMOrg0namEPo9fGoh0eTtDGH2MXDAYh772qS
NuYQ/dKgdqXDvKTI7828CFVUv4JkqPrrce2uDX67eiSce2uDHDKqQZFIdi/uH4K38nPtqgW1vIlj
B/ybC5WUlFBWVtZ9xHjrAA1KObz0haWJKE7WN6ooN93vJHn3W3tQmL+fPh7Tu6kXL/W0gA9VNC/0
3HQ1dg8s29Po3HB4YNluB8l6OX1i2yfGP/3pLZ5+ek7QtnYtxWDwd7Kba0a1TwSn44eHh5+9vZgR
iSYnDk+xjdAbEvwOEUlCplMS/oseaHLiUA1se8e35PRh+fA4qqFRqPpfvEHs2vFGvOUObKsbBWP5
+ASS2YP2NmNQOADzO0cbNVtsw7bhJGE/TQhUZ8/k4MGDTJx4Nw8++Ej3qaamRsqZ+9Nwfrfawk/e
rOLODA1hITK+PeHmpMXHuun+6kWmUcmEgWre2W7H5ZHISlPx5REXy/c4yBsW2qxwrklTkaKX89sC
C5U2iQi1jIEJSjKSlKc9p6G8VWhj+kd17C/3BLo2jtV4efdOHe3dY7Sw8BuKi09w0003tnpBKK1W
i1qtpuhwNtFxbayqSqkUHc72V63PM2jcV+XC/UM9oSP9zib75gr/ULAO2GjVml+Cr8ZNxH1pF/XZ
0j+WjnnxUU7dsxX9r/uCR6L2tR8ISQ9Hd8YwPM2oWMJ+lkjdqz8gObyE9Aqn7i+Hkckh+g8Dm8+v
0xvRtnQd2i7TzzhrtJYrDEre2Gzl+Q1WFDIYlKhkZk5w1er9uyO5Yp2/0/+fux0k6eQ8navl2XHN
v/VVCvjk/ige/peZX6004/TCU7laMpL84SPUMjY9HM1vC+r561YbVpfElXFK3r9Lz5RMTafnS1JS
EkVFRZiOzcHYs/Urm5uOzQH86+2cbwSOo7AS5DI0WX4xOjZXBnWCt9dxQ4iMiLtSL2r+yaNVGL8c
TeWvdlP78kGQQ9j1CcS8MaSJMyp+WRZVT36PZdkJpHo3qiFRxL17NapBzb/EDhw46K/Z3XpLyxxK
YgpV12f37t1YrdaWj009TfXJeYFScfDgwedsMwpaz8yZs9i37z/k5y9v0f6XYqZ/N6Bfv34oFAqK
DmdjKloS8I6eq2pqKloSEGJ6eroQYgfj9XrZvft7pkyZ3OKNaEXJ2E1wOp0cOHAgsF1dz95bzpjP
WAxS6hnzGf0iVCgU9OrVi7i4OJGBlwBCjN3sbWwymSgtLT3rJrUNxMXFkZqaekG3DBAIMQrwDyK3
WCw4nU4cDgdKpRKtVotGo8FgMJyzg18gxCgQXNYIB45AIMQoEAjaJMaCgjVkZ4/mlltu4+WXXxHb
TgsEHYxizpw5c1oS0GCIZujQTJRKJfn5K4iOjqJ//6tEDgoEHUSLh8MZDAaysgyMGDGcTz8tCAz1
EQgEndRmlMvl6PW6QOeyQCDoJDECyGQyRIeIQHBJiFGOJPlE7gkEnS1GnS6CqqpqkXsCQWeL8eqr
h3PgwEHWrfsMs7k+MIlSIBC0nTYNh3O73fzmN0+ybdt2AF544Q+MGZMjclMgaAdtmum/dOn7bNu2
nby8exk2LLPVy0UIBIIOKhnvuWcqcrmc9957R+SgQNCZbUar1SompAoEl4IYJUlCJpOJ3BMIOluM
TqcTpVJMThUIOpIWO3C8Xi8Oh4PvvttJTU0tCQkJIvcEgs4Q49q1nzF37ksAJCUlcvvt40XuCQQd
SIu9qTU1tZSVlREZGUliYoJoMwoEnSVGgUBwYRHLbggEQowCgUCIUSAQYhQIBEKMAoEQo0AgEGIU
CIQYBQJBa/l/zAtRyHcnmJsAAAAASUVORK5CYII=
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 7 Jun 2020 19:23:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 07 15:23:57 2020
Received: from localhost ([127.0.0.1]:54918 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ji0th-0000TN-2V
	for submit <at> debbugs.gnu.org; Sun, 07 Jun 2020 15:23:57 -0400
Received: from aibo.runbox.com ([91.220.196.211]:38706)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <simenheg@HIDDEN>) id 1ji0te-0000TC-He
 for 41544 <at> debbugs.gnu.org; Sun, 07 Jun 2020 15:23:55 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; 
 s=selector1;
 h=Content-Transfer-Encoding:Content-Type:MIME-Version:
 Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From;
 bh=NK0vaqejsfNDfv0cmS1XjUyx+elXF2luW2d5qOZrtLg=; b=d4WyLlvMW5aySLmv1JdsZOqrPF
 /5CR1oxKaYyZX7lHy+hkxFVB/GRoVERUMG1UDsThgF7lpZGywMF5Cq900AavyGDx5sOAHTLgLmSSa
 OP8IuhAKrIQXmqMWgVl4DS6wcqx3UE7EoXfC7Of3CeihYchne4UKVI2Mk31g16tFSjoWg1lGpp2Fo
 XkChLLZM1QP/Msx06T90oVoBo7OYLXVRKw90qQWUqukx7ceLxDitPa25b3bqbUHJwXDkF4rUMGDk2
 6ts9qpkz4BD0TPtifh5BGWj1Vz3MCdDHNQGmHKUAHMr3KVBHyasK7RNA5z+/UkgJPmdO27z3P97oo
 uKgKKAZQ==;
Received: from [10.9.9.73] (helo=submission02.runbox)
 by mailtransmit03.runbox with esmtp (Exim 4.86_2)
 (envelope-from <simenheg@HIDDEN>)
 id 1ji0tc-0003WE-Ck; Sun, 07 Jun 2020 21:23:52 +0200
Received: by submission02.runbox with esmtpsa [Authenticated alias (963757)]
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1)
 id 1ji0tL-0001Ak-9S; Sun, 07 Jun 2020 21:23:35 +0200
From: =?utf-8?Q?Simen_Heggest=C3=B8yl?= <simenheg@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN>
 <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN>
 <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN>
 <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN>
 <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN>
 <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN>
 <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
 <83r1us8kw6.fsf@HIDDEN>
 <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN>
 <83img48ffx.fsf@HIDDEN>
 <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN>
 <83bllw82xt.fsf@HIDDEN> <87pnabfdr5.fsf@simenheg@HIDDEN>
 <2F9BF919-4E8B-4802-AEE8-4438A78B4F68@HIDDEN>
Date: Sun, 07 Jun 2020 21:23:34 +0200
In-Reply-To: <2F9BF919-4E8B-4802-AEE8-4438A78B4F68@HIDDEN> ("Mattias
 =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Sun, 7 Jun 2020 12:14:13
 +0200")
Message-ID: <87d06ar87d.fsf@simenheg@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 41544
Cc: Richard Copley <rcopley@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Mattias Engdeg=C3=A5rd <mattiase@HIDDEN> writes:

> Perhaps you could try list-colours-display and see if you can spot a
> pattern?

Hm, that one seems to use a black foreground color for all of the
entries(?).

-- Simen




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 7 Jun 2020 16:14:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 07 12:14:34 2020
Received: from localhost ([127.0.0.1]:54756 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhxwQ-00024N-KY
	for submit <at> debbugs.gnu.org; Sun, 07 Jun 2020 12:14:34 -0400
Received: from userp2130.oracle.com ([156.151.31.86]:48124)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1jhxwO-00024A-Ti
 for 41544 <at> debbugs.gnu.org; Sun, 07 Jun 2020 12:14:33 -0400
Received: from pps.filterd (userp2130.oracle.com [127.0.0.1])
 by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 057GCA5M135512;
 Sun, 7 Jun 2020 16:14:16 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29;
 bh=w4L+YVdHimdlNtSqE8u4YMQCnyTWBOYvDuA6E6Aeihg=;
 b=hMQ1hM/d379ArZCsfjrpZ0yNbz9OwdvkJPbMsP+RjFmCc8P8Q5GtXRVhJ8joJGMJoS1y
 Uo3bxgYFXGIXGpqzImRmTNf1T1m15msmHwvoSLD3mfg5a+DFpHCN1ryERYYFz6pjqWrN
 SOgGKx7yO/MxUI++GWFf/gWXIryukyBW0p18JwGkU12JwsZepoLdbHPDLjV5SOBTl4M7
 p/8xCXiEYl1NIIU4diCo+buURR8ztcdDpUy939ylkgKP9D4niepCHXzL20q2dBciJdPl
 5ablXXEpUoD0D70Ja7OklNx8d4Dg+TgvONE2b1k4nFhFBY3kTTwAC5SlO8q59gn7PKXZ Rg== 
Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79])
 by userp2130.oracle.com with ESMTP id 31g2jqup02-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL);
 Sun, 07 Jun 2020 16:14:16 +0000
Received: from pps.filterd (userp3020.oracle.com [127.0.0.1])
 by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 057G8HVk161290;
 Sun, 7 Jun 2020 16:12:16 GMT
Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235])
 by userp3020.oracle.com with ESMTP id 31gmwnt11n-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Sun, 07 Jun 2020 16:12:16 +0000
Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9])
 by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 057GCFRZ026435;
 Sun, 7 Jun 2020 16:12:15 GMT
MIME-Version: 1.0
Message-ID: <80aee7da-3f99-4203-8912-81b8cc413326@default>
Date: Sun, 7 Jun 2020 09:12:11 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>, =?utf-8?B?TWF0dGlhcyBFbmdkZWfDpXJk?=
 <mattiase@HIDDEN>
Subject: RE: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN> <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN> <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
 <83r1us8kw6.fsf@HIDDEN> <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN>
 <83img48ffx.fsf@HIDDEN> <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN>
 <b4cbf0a8-d59a-4e8c-a8cf-a8df090f36bf@default>
 <5AEB442C-5592-46E4-BC38-185BA9D2D956@HIDDEN> <83zh9f6j9v.fsf@HIDDEN>
In-Reply-To: <83zh9f6j9v.fsf@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.5005.0 (x86)]
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9645
 signatures=668680
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 spamscore=0 adultscore=0
 mlxscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 phishscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000
 definitions=main-2006070123
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9645
 signatures=668680
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0
 impostorscore=0
 cotscore=-2147483648 priorityscore=1501 spamscore=0 suspectscore=0
 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0
 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.12.0-2004280000 definitions=main-2006070124
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41544
Cc: 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> IME, it is unreasonable to assume that a pair of colors will be
> perceived as "contrasting enough" no matter which of them is
> foreground and which background.  Background colors affect larger
> portions of display, and therefore a bright background is perceived as
> brighter and a dark background as darker, than when the same color is
> used as foreground.

I agree with this.  And as you said earlier, different
eyes see differently (and different devices display
differently).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 7 Jun 2020 16:13:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 07 12:13:07 2020
Received: from localhost ([127.0.0.1]:54751 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhxv1-000220-9E
	for submit <at> debbugs.gnu.org; Sun, 07 Jun 2020 12:13:07 -0400
Received: from userp2120.oracle.com ([156.151.31.85]:34964)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1jhxuz-00021W-Qv
 for 41544 <at> debbugs.gnu.org; Sun, 07 Jun 2020 12:13:06 -0400
Received: from pps.filterd (userp2120.oracle.com [127.0.0.1])
 by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 057GCviN179316;
 Sun, 7 Jun 2020 16:12:57 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29;
 bh=45w37v3jUjvrwJ6FVj7CT1kc8en5/WZUPaVO8jxZodI=;
 b=Y/eijj47HXNmMEKbi5/Ay+ECu6+pf966vZwp+yT7OxrmvVbYKL+1vi4QF7IIo657ePNL
 UL6PvGsy6O9YQGQSDFVST/099gb4hsUXYxRIbFK1ZLzwfGFO+9Ut6wkIwgc67s08MHM1
 A2/Hljkqq07ZB8N+pqv2+MJ9G10p93JoaEDQhpW55jPOxDpv5yVXm85ktuMmPL9bJ4V1
 ucTgJDvyGLIXkG996gVXCEmxiilh1HZ2f0ST2t+rgtpLfhcQSvPTBhTnVlOrcg45ETpf
 4eNMjGmdCLeUe0x+W1HH/pS6VckoKG5dIObmi9x31s9eoGatMoste20r3600ANvOce5V zA== 
Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70])
 by userp2120.oracle.com with ESMTP id 31g3smkj2c-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL);
 Sun, 07 Jun 2020 16:12:56 +0000
Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1])
 by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 057G8F0W043726;
 Sun, 7 Jun 2020 16:10:56 GMT
Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235])
 by aserp3020.oracle.com with ESMTP id 31gn1ygv45-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Sun, 07 Jun 2020 16:10:56 +0000
Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9])
 by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 057GAkGL025870;
 Sun, 7 Jun 2020 16:10:46 GMT
MIME-Version: 1.0
Message-ID: <600300ac-8d00-46ef-881c-f7507c6534ca@default>
Date: Sun, 7 Jun 2020 09:10:43 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>, =?iso-8859-1?B?U2ltZW4gSGVnZ2VzdPh5bA==?=
 <simenheg@HIDDEN>
Subject: RE: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <83o8q2elja.fsf@HIDDEN> <83mu5mel4o.fsf@HIDDEN>
 <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN> <83y2p5cumz.fsf@HIDDEN>
 <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN> <83blm0cjlz.fsf@HIDDEN>
 <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN> <83367ccf8w.fsf@HIDDEN>
 <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN> <83o8pyc4bq.fsf@HIDDEN>
 <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN> <835zc5bsut.fsf@HIDDEN>
 <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN> <838sh0abzz.fsf@HIDDEN>
 <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN> <83r1us8kw6.fsf@HIDDEN>
 <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN> <83img48ffx.fsf@HIDDEN>
 <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN> <83bllw82xt.fsf@HIDDEN>
 <87pnabfdr5.fsf@simenheg@HIDDEN> <831rmr7xzz.fsf@HIDDEN>
In-Reply-To: <831rmr7xzz.fsf@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.5005.0 (x86)]
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9645
 signatures=668680
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0
 suspectscore=0 mlxscore=0
 phishscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=824
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000
 definitions=main-2006070123
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9645
 signatures=668680
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0
 priorityscore=1501
 lowpriorityscore=0 impostorscore=0 cotscore=-2147483648 suspectscore=0
 spamscore=0 bulkscore=0 malwarescore=0 phishscore=0 mlxscore=0
 mlxlogscore=851 clxscore=1011 classifier=spam adjust=0 reason=mlx
 scancount=1 engine=8.12.0-2004280000 definitions=main-2006070124
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41544
Cc: rcopley@HIDDEN, mattiase@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> There are two main factors here on which we have no control:
> the subjective differences between color perception by different
> people, and variations in how different terminals and displays show
> the same colors.

+1.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 7 Jun 2020 16:00:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 07 12:00:50 2020
Received: from localhost ([127.0.0.1]:54731 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhxj8-0000Iy-Aq
	for submit <at> debbugs.gnu.org; Sun, 07 Jun 2020 12:00:50 -0400
Received: from userp2120.oracle.com ([156.151.31.85]:57990)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1jhxj7-0000CS-3o
 for 41544 <at> debbugs.gnu.org; Sun, 07 Jun 2020 12:00:49 -0400
Received: from pps.filterd (userp2120.oracle.com [127.0.0.1])
 by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 057FmNBV143898;
 Sun, 7 Jun 2020 16:00:40 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29;
 bh=n3EfIIw++7jps+FQFmopWCOyPhRRDeAs//GmThRRS5s=;
 b=y+pWIjGdvXhYS4lPss5oym+HkLN8VgGvarBy0TqSoh+jYkxnNop2oCQmWYnodoc+IQnU
 sn5s5GNHBw5fBTSnXGqMZ1RrAqNJKg0uL3qj38ba8GErtJdgkyNSka7tCcc+xExsjP+Z
 7venskQtJ3sM2L9A6r6gNMuQd/S2dLjTYX85uuiBJMdL0LOjBhMe3AdXtrTaJDf/Foi6
 yC5iYopoWAEnXZr/onh22KVEVLPbG7fwCsQ+J7tOlMxBOwtCr35ZqxJzcyyUC1tuOiQR
 wvRGeF+5l7LPYwamxkJwAwCeYMhNqyAXgkiUXtjh3UrNrHN44VTYL3e3VoGFomyMtNG0 Hg== 
Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71])
 by userp2120.oracle.com with ESMTP id 31g3smkhdb-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL);
 Sun, 07 Jun 2020 16:00:40 +0000
Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1])
 by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 057FvrxU185553;
 Sun, 7 Jun 2020 16:00:40 GMT
Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235])
 by aserp3030.oracle.com with ESMTP id 31gmqk20up-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Sun, 07 Jun 2020 16:00:39 +0000
Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9])
 by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 057G0caN021034;
 Sun, 7 Jun 2020 16:00:38 GMT
MIME-Version: 1.0
Message-ID: <93fdabf1-f725-4e8c-a9de-8e4c61ff7973@default>
Date: Sun, 7 Jun 2020 09:00:34 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: =?iso-8859-1?B?TWF0dGlhcyBFbmdkZWflcmQ=?= <mattiase@HIDDEN>
Subject: RE: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN> <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN> <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
 <83r1us8kw6.fsf@HIDDEN> <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN>
 <83img48ffx.fsf@HIDDEN> <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN>
 <b4cbf0a8-d59a-4e8c-a8cf-a8df090f36bf@default>
 <5AEB442C-5592-46E4-BC38-185BA9D2D956@HIDDEN>
In-Reply-To: <5AEB442C-5592-46E4-BC38-185BA9D2D956@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.5005.0 (x86)]
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9645
 signatures=668680
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0
 bulkscore=0 mlxscore=0
 mlxlogscore=999 adultscore=0 spamscore=0 suspectscore=0 malwarescore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000
 definitions=main-2006070122
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9645
 signatures=668680
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0
 priorityscore=1501
 lowpriorityscore=0 impostorscore=0 cotscore=-2147483648 suspectscore=0
 spamscore=0 bulkscore=0 malwarescore=0 phishscore=0 mlxscore=0
 mlxlogscore=999 clxscore=1015 classifier=spam adjust=0 reason=mlx
 scancount=1 engine=8.12.0-2004280000 definitions=main-2006070121
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41544
Cc: Eli Zaretskii <eliz@HIDDEN>, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> > +(defun color-dark-p (rgb)
> > +  "Whether RGB is more readable against white than black.
> > +RGB is a 3-element list (R G B), each component in the range [0,1]."
>=20
> > The predicate name suggests it's about testing a
> > color (via RGB) to determine whether it's dark or
> > light.
> >
> > The doc string suggests it's specifically about
> > the readability of _foreground_ text that is of
> > that color - specifically whether it's more
> > readable against a white than a black background.
>=20
> Thank you, this actually raises a good point.
>=20
> The predicate should work with the argument both as a foreground and as a
> background colour, for selecting a black or white contrasting colour. The
> assumption is that the same predicate can be used for both, which may be
> wrong, but absent evidence to the contrary, I think it is a reasonable on=
e to
> make.
>=20
> If you are in doubt, see if you can come up with a colour for which it do=
es
> not hold. For example, if you find a rare shade of beige that when used f=
or
> text looks better against a white background, but when used as a backgrou=
nd
> prefers black text. I have yet to do so, much less been able to articulat=
e it
> formally as an algorithm.
>=20
> I agree that this could be stated more explicitly in the doc string.

1. Please do consider stating the behavior more explicitly
in the doc.

2. I don't have any special knowledge or suggestion about
whether the same criteria should be used for light and dark
foreground/background.  I'd think that the comparison would
need to use the complement of the foreground or background,
a priori.  E.g. if a background is 90% light then what
works as a "readable" dark foreground would lead to a light
foreground that is more or less similarly "readable" when
against a 90% dark background.
___

In my own work, when I supply a default foreground or
background for a face, I typically do this:

I start with a light background (my own setup uses LightBlue
- somewhat light), and I pick a color that seems reasonable
enough for the foreground default - by eyeball.  Then I
check it against the default (emacs -Q) background - again,
by eyeball.

Once I've picked a default foreground color for a light
`background-mode', I take its complement (using `hexrgb.el')
as the default foreground for a dark background.  I check
that with emacs -Q.  (I use a light background in my setup,
and I don't spend a lot of energy trying to get a great
default for a dark background.)

In my experience (feedback from users), complementing works
pretty well.  And since, in my setup, I use a background
that's only somewhat light, it gives a pretty good idea of
what works (according to my eyes) for a complemented
(hence somewhat dark) background.

No idea whether any of this info helps you, but it's
what I do.  I don't use color-distance in this endeavor.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 7 Jun 2020 14:30:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 07 10:30:19 2020
Received: from localhost ([127.0.0.1]:54588 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhwJX-0005gP-DG
	for submit <at> debbugs.gnu.org; Sun, 07 Jun 2020 10:30:19 -0400
Received: from eggs.gnu.org ([209.51.188.92]:52800)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jhwJV-0005gA-Pz
 for 41544 <at> debbugs.gnu.org; Sun, 07 Jun 2020 10:30:18 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:52335)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jhwJQ-0004Ze-H3; Sun, 07 Jun 2020 10:30:12 -0400
Received: from [176.228.60.248] (port=3624 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jhwJM-0003wP-GT; Sun, 07 Jun 2020 10:30:11 -0400
Date: Sun, 07 Jun 2020 17:30:04 +0300
Message-Id: <83zh9f6j9v.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <5AEB442C-5592-46E4-BC38-185BA9D2D956@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Sun, 7 Jun 2020 11:13:01 +0200)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN> <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN> <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
 <83r1us8kw6.fsf@HIDDEN> <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN>
 <83img48ffx.fsf@HIDDEN> <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN>
 <b4cbf0a8-d59a-4e8c-a8cf-a8df090f36bf@default>
 <5AEB442C-5592-46E4-BC38-185BA9D2D956@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: 41544
Cc: 41544 <at> debbugs.gnu.org, drew.adams@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

> From: Mattias EngdegÄrd <mattiase@HIDDEN>
> Date: Sun, 7 Jun 2020 11:13:01 +0200
> Cc: Eli Zaretskii <eliz@HIDDEN>, 41544 <at> debbugs.gnu.org
> 
> The predicate should work with the argument both as a foreground and as a background colour, for selecting a black or white contrasting colour. The assumption is that the same predicate can be used for both, which may be wrong, but absent evidence to the contrary, I think it is a reasonable one to make.

IME, it is unreasonable to assume that a pair of colors will be
perceived as "contrasting enough" no matter which of them is
foreground and which background.  Background colors affect larger
portions of display, and therefore a bright background is perceived as
brighter and a dark background as darker, than when the same color is
used as foreground.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 7 Jun 2020 14:26:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 07 10:26:55 2020
Received: from localhost ([127.0.0.1]:54579 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhwGF-0005Zl-KF
	for submit <at> debbugs.gnu.org; Sun, 07 Jun 2020 10:26:55 -0400
Received: from eggs.gnu.org ([209.51.188.92]:52206)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jhwGE-0005ZX-GN
 for 41544 <at> debbugs.gnu.org; Sun, 07 Jun 2020 10:26:54 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:52282)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jhwG8-00046V-DJ; Sun, 07 Jun 2020 10:26:48 -0400
Received: from [176.228.60.248] (port=3419 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jhwG6-0006tM-Gy; Sun, 07 Jun 2020 10:26:47 -0400
Date: Sun, 07 Jun 2020 17:26:40 +0300
Message-Id: <831rmr7xzz.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Simen =?iso-8859-1?Q?Heggest=F8yl?= <simenheg@HIDDEN>
In-Reply-To: <87pnabfdr5.fsf@simenheg@HIDDEN> (message from Simen
 =?iso-8859-1?Q?Heggest=F8yl?= on Sun, 07 Jun 2020 11:04:30 +0200)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <83o8q2elja.fsf@HIDDEN> <83mu5mel4o.fsf@HIDDEN>
 <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN>
 <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN>
 <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN>
 <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN>
 <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN>
 <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN>
 <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
 <83r1us8kw6.fsf@HIDDEN>
 <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN>
 <83img48ffx.fsf@HIDDEN>
 <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN>
 <83bllw82xt.fsf@HIDDEN> <87pnabfdr5.fsf@simenheg@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: 41544
Cc: rcopley@HIDDEN, mattiase@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

> From: Simen Heggestűyl <simenheg@HIDDEN>
> Cc: Mattias Engdegćrd <mattiase@HIDDEN>,  Richard Copley
>  <rcopley@HIDDEN>, 41544 <at> debbugs.gnu.org
> Date: Sun, 07 Jun 2020 11:04:30 +0200
> 
> I can't comment on the patch overall, but this part at least seems to
> address Richard Copley's complaints in bug#30295. A dark foreground is
> now used for #0f0/rgba(0,255,0,0.5) and #5e5 as Richard requested, which
> indeed looks more readable to me too.
> 
> Maybe the pendulum has swung too far however. For instance, a dark
> foreground is now used for #ef716e, which I think was easier to read
> with the light foreground used before. Could that be fixed by tweaking
> the cut-off values in color-dark-p, perhaps?

We can (and did) tweak the various constants involved in this, more
than once.  The lesson I took from that is that we could never produce
something that will fit all the needs, let alone satisfy all the
users.  There are two main factors here on which we have no control:
the subjective differences between color perception by different
people, and variations in how different terminals and displays show
the same colors.

That is why I object to making changes in this low-level functionality
with the motivation of "fixing them all": I think it's simply
impossible.  We will make it slightly better in some situations and
slightly worse in others.  There's no net win here.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 7 Jun 2020 10:14:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 07 06:14:27 2020
Received: from localhost ([127.0.0.1]:53393 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhsJv-0005Qr-At
	for submit <at> debbugs.gnu.org; Sun, 07 Jun 2020 06:14:27 -0400
Received: from mail1461c50.megamailservers.eu ([91.136.14.61]:37190
 helo=mail267c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jhsJs-0005Qb-By
 for 41544 <at> debbugs.gnu.org; Sun, 07 Jun 2020 06:14:25 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591524857;
 bh=zjYuVmjhXys6SkEowKSw6xzMGXpZAriCIG1Yu4VIhsY=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=AZa2+jDjpHf1ZGk7IDBeL/xL4yigsDRH/rbSOti9FdqbKW5SNoT3hQ6bAphIJ3UpT
 ZxthxAptRdk6lH6xmERZdHaFYDmLykxtkwBw9NBgo4vxoIP0pC/kJTD2xcneR+L99w
 rGDUw0PAQtWCsLQeLOIWEpWjWG73K1+up5XwcIpI=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail267c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 057AED6J027527; 
 Sun, 7 Jun 2020 10:14:15 +0000
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <87pnabfdr5.fsf@simenheg@HIDDEN>
Date: Sun, 7 Jun 2020 12:14:13 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <2F9BF919-4E8B-4802-AEE8-4438A78B4F68@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <83o8q2elja.fsf@HIDDEN> <83mu5mel4o.fsf@HIDDEN>
 <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN> <83y2p5cumz.fsf@HIDDEN>
 <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN> <83blm0cjlz.fsf@HIDDEN>
 <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN> <83367ccf8w.fsf@HIDDEN>
 <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN> <83o8pyc4bq.fsf@HIDDEN>
 <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN> <835zc5bsut.fsf@HIDDEN>
 <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN> <838sh0abzz.fsf@HIDDEN>
 <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN> <83r1us8kw6.fsf@HIDDEN>
 <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN> <83img48ffx.fsf@HIDDEN>
 <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN> <83bllw82xt.fsf@HIDDEN>
 <87pnabfdr5.fsf@simenheg@HIDDEN>
To: =?utf-8?Q?Simen_Heggest=C3=B8yl?= <simenheg@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F1D.5EDCBD89.0029:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=Cf92G4jl c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=IkcTkHD0fZMA:10 a=M51BFTxLslgA:10
 a=7DrQrguiAAAA:8 a=NCMz9fsz5WZ6VZw0lv4A:9 a=QEXdDO2ut3YA:10
 a=5p0t1moz68ydotlU2Z85:22
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  7 juni 2020 kl. 11.04 skrev Simen HeggestĂžyl <simenheg@HIDDEN>:
    > I can't comment on the patch overall, but this part at least seems to >
    address Richard Copley's complaints in bug#30295. A dark foreground is >
   now used for #0f0/rgba(0,255,0,0.5) and #5e5 as Richa [...] 
 
 Content analysis details:   (1.2 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
                             blocked.  See
                             http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
                              for more information.
                             [URIs: megamailservers.eu]
  1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.3 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 41544
Cc: Richard Copley <rcopley@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

7 juni 2020 kl. 11.04 skrev Simen Heggest=C3=B8yl <simenheg@HIDDEN>:

> I can't comment on the patch overall, but this part at least seems to
> address Richard Copley's complaints in bug#30295. A dark foreground is
> now used for #0f0/rgba(0,255,0,0.5) and #5e5 as Richard requested, =
which
> indeed looks more readable to me too.

Thank you, and yes, this was actually one of the motivations.

> Maybe the pendulum has swung too far however. For instance, a dark
> foreground is now used for #ef716e, which I think was easier to read
> with the light foreground used before. Could that be fixed by tweaking
> the cut-off values in color-dark-p, perhaps?

Right; the current predicate should be a significant overall improvement =
but there are inevitably some colours where the decision isn't quite =
right. I'll see what can be done about it. It seems to be mainly those =
somewhat reddish colours that need some work.
Perhaps you could try list-colours-display and see if you can spot a =
pattern?

I'll be back with a longer reply on the principles later.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 7 Jun 2020 09:13:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 07 05:13:29 2020
Received: from localhost ([127.0.0.1]:53301 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhrMi-0003py-0x
	for submit <at> debbugs.gnu.org; Sun, 07 Jun 2020 05:13:29 -0400
Received: from mail1452c50.megamailservers.eu ([91.136.14.52]:55370
 helo=mail266c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jhrMe-0003pe-KG
 for 41544 <at> debbugs.gnu.org; Sun, 07 Jun 2020 05:13:14 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591521185;
 bh=ad0x7GweSYEUi4Vg+4WmH0UGicKq4vEERx2Xbjf9UbQ=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=gTXE1eHV+fs+0L60t83PoHMepBTdcuMsgeWcas1JmzJiTL/xRI5NKiho31yctuxvh
 yYPWL59R+eGQLnvSTZNcvf+0PhF+MfkbmTp5Y6UG3VqJ+ghQEPnDyINk+HE7emp7r/
 Ki3pf+e4J+h95+fQ55yKaozvnNWJRjf6HONcwa7E=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail266c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0579D1x6012431; 
 Sun, 7 Jun 2020 09:13:04 +0000
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
X-Priority: 3
In-Reply-To: <b4cbf0a8-d59a-4e8c-a8cf-a8df090f36bf@default>
Date: Sun, 7 Jun 2020 11:13:01 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <5AEB442C-5592-46E4-BC38-185BA9D2D956@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN> <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN> <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
 <83r1us8kw6.fsf@HIDDEN> <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN>
 <83img48ffx.fsf@HIDDEN> <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN>
 <b4cbf0a8-d59a-4e8c-a8cf-a8df090f36bf@default>
To: Drew Adams <drew.adams@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F23.5EDCAF25.0023:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=A5MSwJeG c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10
 a=yPCof4ZbAAAA:8 a=iLj94LE5IQj3-QTxvVkA:9 a=CjuIK1q_8ugA:10
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: 6 juni 2020 kl. 20.15 skrev Drew Adams
 <drew.adams@HIDDEN>:
 > +(defun color-dark-p (rgb) > + "Whether RGB is more readable against white
 than black. > +RGB is a 3-element list (R G B), each component in the range
 [0,1]." Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: megamailservers.eu]
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.3 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 41544
Cc: Eli Zaretskii <eliz@HIDDEN>, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

6 juni 2020 kl. 20.15 skrev Drew Adams <drew.adams@HIDDEN>:

> +(defun color-dark-p (rgb)
> +  "Whether RGB is more readable against white than black.
> +RGB is a 3-element list (R G B), each component in the range [0,1]."

> The predicate name suggests it's about testing a
> color (via RGB) to determine whether it's dark or
> light.
>=20
> The doc string suggests it's specifically about
> the readability of _foreground_ text that is of
> that color - specifically whether it's more
> readable against a white than a black background.

Thank you, this actually raises a good point.

The predicate should work with the argument both as a foreground and as =
a background colour, for selecting a black or white contrasting colour. =
The assumption is that the same predicate can be used for both, which =
may be wrong, but absent evidence to the contrary, I think it is a =
reasonable one to make.

If you are in doubt, see if you can come up with a colour for which it =
does not hold. For example, if you find a rare shade of beige that when =
used for text looks better against a white background, but when used as =
a background prefers black text. I have yet to do so, much less been =
able to articulate it formally as an algorithm.

I agree that this could be stated more explicitly in the doc string.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 7 Jun 2020 09:04:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 07 05:04:36 2020
Received: from localhost ([127.0.0.1]:53296 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhrEK-0003aO-5O
	for submit <at> debbugs.gnu.org; Sun, 07 Jun 2020 05:04:36 -0400
Received: from aibo.runbox.com ([91.220.196.211]:38770)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <simenheg@HIDDEN>) id 1jhrEH-0003aD-VJ
 for 41544 <at> debbugs.gnu.org; Sun, 07 Jun 2020 05:04:35 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; 
 s=selector1;
 h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From;
 bh=i2bPAZIn58UZ7lWpLe3yIawPjlzsnUqTxJWqGncpfEI=; b=Akon/NWL9Zm8rmV2i97yIvARrc
 KKeyimA7T/4aQuzuc5ESG2adUnrB6Uf/ZU9uLuo4NXxd5uO5ZDi170HOEPIlQJFlqKcOPakh59BbR
 P/URyC48UvtX+nqWnYgPLWdbNNai2eYfifZV4xnTdHrF5za42Gcbhum8peMX4K/6udCPHm3q26jKr
 CnuDtOLGS6wLGeqfHYZv6+XPeybYLfcoY646KWCzUq7G9YjX4i3sVy0loKMeQbhwmfgt6at+1dG6j
 T/sqPFT5QsV028Ot/TdalRL9Uk7Luum8dFjF3rEWThdyqPxLo2xKbP0E0lbJ1oJL3MSswMTHckkIU
 oy52714A==;
Received: from [10.9.9.73] (helo=submission02.runbox)
 by mailtransmit03.runbox with esmtp (Exim 4.86_2)
 (envelope-from <simenheg@HIDDEN>)
 id 1jhrEF-0001PO-9l; Sun, 07 Jun 2020 11:04:31 +0200
Received: by submission02.runbox with esmtpsa [Authenticated alias (963757)]
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1)
 id 1jhrEF-0000hE-67; Sun, 07 Jun 2020 11:04:31 +0200
From: =?utf-8?Q?Simen_Heggest=C3=B8yl?= <simenheg@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <83o8q2elja.fsf@HIDDEN> <83mu5mel4o.fsf@HIDDEN>
 <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN>
 <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN>
 <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN>
 <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN>
 <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN>
 <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN>
 <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
 <83r1us8kw6.fsf@HIDDEN>
 <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN>
 <83img48ffx.fsf@HIDDEN>
 <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN>
 <83bllw82xt.fsf@HIDDEN>
Date: Sun, 07 Jun 2020 11:04:30 +0200
In-Reply-To: <83bllw82xt.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 06 Jun
 2020 21:27:42 +0300")
Message-ID: <87pnabfdr5.fsf@simenheg@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 41544
Cc: Richard Copley <rcopley@HIDDEN>,
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

>> -(defun css--contrasty-color (name)
>> -  "Return a color that contrasts with NAME.
>> -NAME is of any form accepted by `color-distance'.
>> -The returned color will be usable by Emacs and will contrast
>> -with NAME; in particular so that if NAME is used as a background
>> -color, the returned color can be used as the foreground and still
>> -be readable."
>> -  ;; See bug#25525 for a discussion of this.
>> -  (if (> (color-distance name "black") 292485)
>> -      "black" "white"))
>> -
>>  (defcustom css-fontify-colors t
>>    "Whether CSS colors should be fontified using the color as the background.
>>  When non-`nil', a text representing CSS color will be fontified
>> @@ -1199,7 +1188,8 @@ css--fontify-region
>>  		    (add-text-properties
>>  		     start (point)
>>  		     (list 'face (list :background color
>> -				       :foreground (css--contrasty-color color)
>> +				       :foreground (readable-foreground-color
>> +                                                    color)
>>  				       :box '(:line-width -1))))))))))))
>>      extended-region))
>
> Here, once again I will ask what practical problem is being fixed.

I can't comment on the patch overall, but this part at least seems to
address Richard Copley's complaints in bug#30295. A dark foreground is
now used for #0f0/rgba(0,255,0,0.5) and #5e5 as Richard requested, which
indeed looks more readable to me too.

Maybe the pendulum has swung too far however. For instance, a dark
foreground is now used for #ef716e, which I think was easier to read
with the light foreground used before. Could that be fixed by tweaking
the cut-off values in color-dark-p, perhaps?

-- Simen




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 6 Jun 2020 18:28:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 06 14:28:03 2020
Received: from localhost ([127.0.0.1]:52451 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhdY3-0007EV-7F
	for submit <at> debbugs.gnu.org; Sat, 06 Jun 2020 14:28:03 -0400
Received: from eggs.gnu.org ([209.51.188.92]:51438)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jhdY1-0007Dp-4t
 for 41544 <at> debbugs.gnu.org; Sat, 06 Jun 2020 14:28:01 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:36188)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jhdXv-0002o3-TR; Sat, 06 Jun 2020 14:27:55 -0400
Received: from [176.228.60.248] (port=1972 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jhdXr-0001xZ-W0; Sat, 06 Jun 2020 14:27:53 -0400
Date: Sat, 06 Jun 2020 21:27:42 +0300
Message-Id: <83bllw82xt.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Sat, 6 Jun 2020 18:54:41 +0200)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN> <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN> <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
 <83r1us8kw6.fsf@HIDDEN> <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN>
 <83img48ffx.fsf@HIDDEN> <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41544
Cc: 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Mattias EngdegÄrd <mattiase@HIDDEN>
> Date: Sat, 6 Jun 2020 18:54:41 +0200
> Cc: 41544 <at> debbugs.gnu.org
> 
> Since we are making little progress, let's leave color-name-to-rgb unchanged for the moment. We can both change our minds later. It's not strictly required for the introduction and use of color-dark-p; patch updated.

What practical problem is being solved here?  (Please don't say "this
was done in different ways", that's not a practical problem from my
POV.)

> * lisp/facemenu.el (list-colors-print): Use readable-foreground-color.

I don't mind installing this part, but have the rationale should be
spelled out in the log message.

> --- a/lisp/faces.el
> +++ b/lisp/faces.el
> @@ -1786,15 +1786,24 @@ defined-colors-with-face-attributes
>  
>  (defun readable-foreground-color (color)
>    "Return a readable foreground color for background COLOR."
> -  (let* ((rgb   (color-values color))
> -	 (max   (apply #'max rgb))
> -	 (black (car (color-values "black")))
> -	 (white (car (color-values "white"))))
> -    ;; Select black or white depending on which one is less similar to
> -    ;; the brightest component.
> -    (if (> (abs (- max black)) (abs (- max white)))
> -	"black"
> -      "white")))

What was wrong with the original code?  If it produced sub-optimal
results, please show an example of that.

> +(defun color-dark-p (rgb)
> +  "Whether RGB is more readable against white than black.
> +RGB is a 3-element list (R G B), each component in the range [0,1]."
> +  (let* ((sr (nth 0 rgb))
> +         (sg (nth 1 rgb))
> +         (sb (nth 2 rgb))
> +         ;; Use the power 2.2 as an approximation to sRGB gamma;
> +         ;; it should be good enough for the purpose of this function.
> +         (r (expt sr 2.2))
> +         (g (expt sg 2.2))
> +         (b (expt sb 2.2)))
> +    (unless (<= 0 (min r g b) (max r g b) 1)
> +      (error "RGB components %S not in [0,1]" rgb))
> +    ;; The cut-off value was determined experimentally; see bug#41544.
> +    (< (+ (* r 0.299) (* g 0.587) (* b 0.114))
> +       (eval-when-compile (expt 0.6 2.2)))))

This code's algorithm and rationale should be explained in the
comments before we can discuss whether it's an improvement and why.

> diff --git a/lisp/frame.el b/lisp/frame.el
> index 6c2f774709..253528da75 100644
> --- a/lisp/frame.el
> +++ b/lisp/frame.el
> @@ -1156,6 +1156,13 @@ frame-background-mode

This is a non-starter, sorry.  I'm not interested in changing what is
considered dark and light background of a frame.

> diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el
> index 31e3d6ede4..5dc754c8e0 100644
> --- a/lisp/term/rxvt.el
> +++ b/lisp/term/rxvt.el
> @@ -206,13 +206,11 @@ rxvt-set-background-mode

Likewise here.

> diff --git a/lisp/term/w32console.el b/lisp/term/w32console.el
> index 36e9d896c7..0e9d7c8b5c 100644
> --- a/lisp/term/w32console.el
> +++ b/lisp/term/w32console.el
> @@ -86,9 +86,9 @@ terminal-init-w32console
>      (setq r (nth 2 descr)
>  	  g (nth 3 descr)
>  	  b (nth 4 descr))
> -    (if (< (+ r g b) (* .6 (+ 65535 65535 65535)))
> -	(setq bg-mode 'dark)
> -      (setq bg-mode 'light))
> +    (setq bg-mode (if (color-dark-p
> +                       (list (/ r 65535.0) (/ g 65535.0) (/ b 65535.0)))
> +                      'dark 'light))
>      (set-terminal-parameter nil 'background-mode bg-mode))

And here.

> diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
> index 1a727e3933..bf9bcae526 100644
> --- a/lisp/term/xterm.el
> +++ b/lisp/term/xterm.el
> @@ -1120,9 +1120,8 @@ xterm-register-default-colors
>      (clear-face-cache)))
>  
>  (defun xterm-maybe-set-dark-background-mode (redc greenc bluec)
> -  ;; Use the heuristic in `frame-set-background-mode' to decide if a
> -  ;; frame is dark.
> -  (when (< (+ redc greenc bluec) (* .6 (+ 65535 65535 65535)))
> +  (when (color-dark-p (mapcar (lambda (c) (/ c 65535.0))
> +                              (list redc greenc bluec)))
>      (set-terminal-parameter nil 'background-mode 'dark)

And here.

> -(defun css--contrasty-color (name)
> -  "Return a color that contrasts with NAME.
> -NAME is of any form accepted by `color-distance'.
> -The returned color will be usable by Emacs and will contrast
> -with NAME; in particular so that if NAME is used as a background
> -color, the returned color can be used as the foreground and still
> -be readable."
> -  ;; See bug#25525 for a discussion of this.
> -  (if (> (color-distance name "black") 292485)
> -      "black" "white"))
> -
>  (defcustom css-fontify-colors t
>    "Whether CSS colors should be fontified using the color as the background.
>  When non-`nil', a text representing CSS color will be fontified
> @@ -1199,7 +1188,8 @@ css--fontify-region
>  		    (add-text-properties
>  		     start (point)
>  		     (list 'face (list :background color
> -				       :foreground (css--contrasty-color color)
> +				       :foreground (readable-foreground-color
> +                                                    color)
>  				       :box '(:line-width -1))))))))))))
>      extended-region))

Here, once again I will ask what practical problem is being fixed.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 6 Jun 2020 18:16:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 06 14:16:15 2020
Received: from localhost ([127.0.0.1]:52425 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhdMc-0006wO-Oy
	for submit <at> debbugs.gnu.org; Sat, 06 Jun 2020 14:16:14 -0400
Received: from aserp2120.oracle.com ([141.146.126.78]:55324)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1jhdMb-0006vt-OY
 for 41544 <at> debbugs.gnu.org; Sat, 06 Jun 2020 14:16:14 -0400
Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1])
 by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 056I6wkD001273;
 Sat, 6 Jun 2020 18:16:05 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29;
 bh=EVFa0tZNc+J1Qg4Z4I8JuUxFh2NswrWXqaSlCiCBa2k=;
 b=LWaX+24LOOz7WZDVkZThoqYLbqQBubJTtlu6/lLHg4ZSawrdQ8DRCkqQV/HqrRU45x48
 muOcSzBITmaKYyuuj2TGm54LCT5/bOikqLEw2kP+JxdnzY20S5UGB8M9SUyRR5+gjsJq
 tsnlld9AUaDufU9q0aGXaZn4zpxCRKR8HQvEu2WNtjZ/iYSup82kkWhc0KAUG93nIzSN
 iJXtlWxEE8eE6jbBRMxJgaZu/BsJuYFPHdm6PnBAXy0ShCy0XpFW4iZtkxmg7pijDsGv
 tabXfWdXRvwY3fE09lpiOt4AYn2kQZZczU9IbAgL4X7Ve9z2FZmvl4JJohbYyKote6hN 9g== 
Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79])
 by aserp2120.oracle.com with ESMTP id 31g33ksksn-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL);
 Sat, 06 Jun 2020 18:16:05 +0000
Received: from pps.filterd (userp3020.oracle.com [127.0.0.1])
 by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 056I8FXo146440;
 Sat, 6 Jun 2020 18:16:04 GMT
Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235])
 by userp3020.oracle.com with ESMTP id 31g2fhh522-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Sat, 06 Jun 2020 18:16:04 +0000
Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17])
 by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 056IG0KJ015542;
 Sat, 6 Jun 2020 18:16:01 GMT
MIME-Version: 1.0
Message-ID: <b4cbf0a8-d59a-4e8c-a8cf-a8df090f36bf@default>
Date: Sat, 6 Jun 2020 11:15:57 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: =?iso-8859-1?B?TWF0dGlhcyBFbmdkZWflcmQ=?= <mattiase@HIDDEN>, Eli
 Zaretskii <eliz@HIDDEN>
Subject: RE: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN> <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN> <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
 <83r1us8kw6.fsf@HIDDEN> <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN>
 <83img48ffx.fsf@HIDDEN> <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN>
In-Reply-To: <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.5005.0 (x86)]
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9644
 signatures=668680
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0
 suspectscore=0 adultscore=0
 phishscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000
 definitions=main-2006060145
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9644
 signatures=668680
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 adultscore=0 spamscore=0
 cotscore=-2147483648 malwarescore=0 phishscore=0 mlxscore=0 clxscore=1011
 lowpriorityscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=999
 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.12.0-2004280000 definitions=main-2006060145
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41544
Cc: 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

(Not following this thread; apologies.)

Noticed this in the patch:

+(defun color-dark-p (rgb)
+  "Whether RGB is more readable against white than black.
+RGB is a 3-element list (R G B), each component in the range [0,1]."

Something seems a bit wrong, here.  Dunno whether
it's the predicate name or the doc string (or both).

The predicate name suggests it's about testing a
color (via RGB) to determine whether it's dark or
light.

The doc string suggests it's specifically about
the readability of _foreground_ text that is of
that color - specifically whether it's more
readable against a white than a black background.

Maybe the predicate name should be changed to
indicate (1) that it's about RGB as a foreground
and (2) it's compared (in terms of contrast or
value or whatever) to a white and black background.

Just a suggestion.  Discovery, based on the
predicate name, will mislead as it is now, I think.

I also think the doc string could say just what it
means by "more readable", i.e. what kind of RGB (or
other) test it uses.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 6 Jun 2020 16:54:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 06 12:54:49 2020
Received: from localhost ([127.0.0.1]:52351 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhc5p-0004zS-8X
	for submit <at> debbugs.gnu.org; Sat, 06 Jun 2020 12:54:49 -0400
Received: from mail85c50.megamailservers.eu ([91.136.10.95]:37822
 helo=mail18c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jhc5m-0004zI-OQ
 for 41544 <at> debbugs.gnu.org; Sat, 06 Jun 2020 12:54:47 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591462484;
 bh=Dds8aXuevS4wq1D2mmOF90T3VLD0LEqC1wVjfMJ6xx0=;
 h=From:Subject:Date:In-Reply-To:Cc:To:References:From;
 b=mQ6T//fqGfn1Gx4CHCQZK9xF9PowGSM5pCe0+Y/fASvb9LJG4E6X7KQbm1UmTxfw3
 6nokwdCFVU++kmLQESdjqNKbIgGIPAtvJ4qxJIDdTYOkC4ucQz1YSucqOX9oQszlOy
 OocKZ4MPA+kY6V3x7XGL+WVFHn9+OAhmvNodkoEo=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail18c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 056GsgpG019201; 
 Sat, 6 Jun 2020 16:54:44 +0000
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Message-Id: <EAD39303-6870-4E5F-8D3B-4B4DE29AD57B@HIDDEN>
Content-Type: multipart/mixed;
 boundary="Apple-Mail=_DB782CBA-D227-410A-B6EF-143B5FD5022B"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
Date: Sat, 6 Jun 2020 18:54:41 +0200
In-Reply-To: <83img48ffx.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN> <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN> <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
 <83r1us8kw6.fsf@HIDDEN> <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN>
 <83img48ffx.fsf@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F26.5EDBC9F6.003F:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=K8Zc4BeI c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=M51BFTxLslgA:10 a=mDV3o1hIAAAA:8
 a=jVEikXp7SrS73UKdutoA:9 a=CjuIK1q_8ugA:10 a=LUiTdrM7ar1z_bhPKtoA:9
 a=B2y7HmGcmWMA:10 a=_FVE-zBwftR9WsbkzFJk:22
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  6 juni 2020 kl. 15.57 skrev Eli Zaretskii <eliz@HIDDEN>:
 >> can you come up with a concrete and realistic example of what you think
 will break? > > None at this time. That's high praise! 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: megamailservers.eu]
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.3 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 41544
Cc: 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)


--Apple-Mail=_DB782CBA-D227-410A-B6EF-143B5FD5022B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

6 juni 2020 kl. 15.57 skrev Eli Zaretskii <eliz@HIDDEN>:

>> can you come up with a concrete and realistic example of what you =
think will break?
>=20
> None at this time.

That's high praise!

> I think a Lisp program that interprets the documentation too
> literally is making a mistake

I must remember that, a most useful answer!

> , but I'm not opposed to make that
> clearer in the docs.

No, I really don't think we should document the bug.

Since we are making little progress, let's leave color-name-to-rgb =
unchanged for the moment. We can both change our minds later. It's not =
strictly required for the introduction and use of color-dark-p; patch =
updated.


--Apple-Mail=_DB782CBA-D227-410A-B6EF-143B5FD5022B
Content-Disposition: attachment;
	filename=0001-Use-a-single-light-dark-colour-predicate.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="0001-Use-a-single-light-dark-colour-predicate.patch"
Content-Transfer-Encoding: quoted-printable

=46rom=20f7693e7a2e6cc65ad40d42c9854539ed85466bae=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20=
<mattiase@HIDDEN>=0ADate:=20Sun,=2031=20May=202020=2021:12:46=20+0200=0A=
Subject:=20[PATCH]=20Use=20a=20single=20light/dark=20colour=20predicate=0A=
=0AAdd=20a=20single=20predicate,=20color-dark-p,=20for=20deciding=20=
whether=20a=20colour=0Ais=20more=20readable=20against=20black=20or=20=
white.=20=20Previously=20this=20was=20done=20in=0Adifferent=20ways=20in=20=
several=20places,=20and=20with=20worse=20results.=20=20(Bug#41544)=0A=0A=
*=20lisp/facemenu.el=20(list-colors-print):=20Use=20=
readable-foreground-color.=0A(color-dark-p):=20New=20function.=0A*=20=
lisp/term/pc-win.el:=20Update=20comment.=0A*=20lisp/term/rxvt.el=20=
(rxvt-set-background-mode):=0A*=20lisp/term/w32console.el=20=
(terminal-init-w32console):=0A*=20lisp/term/xterm.el=20=
(xterm-maybe-set-dark-background-mode):=0A*=20lisp/faces.el=20=
(readable-foreground-color):=0A*=20lisp/frame.el=20=
(frame-set-background-mode):=20Use=20color-dark-p.=0A*=20=
lisp/textmodes/css-mode.el=20(css--contrasty-color):=20Remove.=0A=
(css--fontify-region):=20Use=20color-dark-p.=0A---=0A=20lisp/facemenu.el=20=
=20=20=20=20=20=20=20=20=20=20|=2011=20+++++------=0A=20lisp/faces.el=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20|=2027=20++++++++++++++++++---------=0A=
=20lisp/frame.el=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=2017=20=
++++++++++-------=0A=20lisp/term/pc-win.el=20=20=20=20=20=20=20=20|=20=20=
8=20+++-----=0A=20lisp/term/rxvt.el=20=20=20=20=20=20=20=20=20=20|=2012=20=
+++++-------=0A=20lisp/term/w32console.el=20=20=20=20|=20=206=20+++---=0A=
=20lisp/term/xterm.el=20=20=20=20=20=20=20=20=20|=20=205=20++---=0A=20=
lisp/textmodes/css-mode.el=20|=2014=20++------------=0A=208=20files=20=
changed,=2048=20insertions(+),=2052=20deletions(-)=0A=0Adiff=20--git=20=
a/lisp/facemenu.el=20b/lisp/facemenu.el=0Aindex=20b10d874b21..419b76101b=20=
100644=0A---=20a/lisp/facemenu.el=0A+++=20b/lisp/facemenu.el=0A@@=20=
-621,12=20+621,11=20@@=20list-colors-print=0A=20=09=09=09=09=09=09=20=
(downcase=20b))))))=0A=20=09(setq=20color=20(list=20color)))=0A=20=20=20=20=
=20=20=20(let*=20((opoint=20(point))=0A-=09=20=20=20=20=20(color-values=20=
(color-values=20(car=20color)))=0A-=09=20=20=20=20=20(light-p=20(>=3D=20=
(apply=20'max=20color-values)=0A-=09=09=09=20=20(*=20(car=20=
(color-values=20"white"))=20.5))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20(fg=20(readable-foreground-color=20(car=20color))))=0A=20=09(insert=20=
(car=20color))=0A=20=09(indent-to=2022)=0A-=09(put-text-property=20=
opoint=20(point)=20'face=20`(:background=20,(car=20color)))=0A+=09=
(put-text-property=20opoint=20(point)=20'face=20`(:background=20,(car=20=
color)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20:foreground=20,fg))=0A=20=09(put-text-property=0A=20=09=20=
(prog1=20(point)=0A=20=09=20=20=20(insert=20"=20")=0A@@=20-639,7=20=
+638,7=20@@=20list-colors-print=0A=20=09(insert=20(propertize=0A=20=09=09=
=20(apply=20'format=20"#%02x%02x%02x"=0A=20=09=09=09(mapcar=20(lambda=20=
(c)=20(ash=20c=20-8))=0A-=09=09=09=09color-values))=0A+=09=09=09=09=
(color-values=20(car=20color))))=0A=20=09=09=20'mouse-face=20'highlight=0A=
=20=09=09=20'help-echo=0A=20=09=09=20(let=20((hsv=20(apply=20=
'color-rgb-to-hsv=0A@@=20-651,7=20+650,7=20@@=20list-colors-print=0A=20=09=
=20=20=20opoint=20(point)=0A=20=09=20=20=20'follow-link=20t=0A=20=09=20=20=
=20'mouse-face=20(list=20:background=20(car=20color)=0A-=09=09=09=20=20=20=
=20=20:foreground=20(if=20light-p=20"black"=20"white"))=0A+=09=09=09=20=20=
=20=20=20:foreground=20fg)=0A=20=09=20=20=20'color-name=20(car=20color)=0A=
=20=09=20=20=20'action=20callback-fn)))=0A=20=20=20=20=20=20=20(insert=20=
"\n"))=0Adiff=20--git=20a/lisp/faces.el=20b/lisp/faces.el=0Aindex=20=
e707f6f4b6..caa72fbfff=20100644=0A---=20a/lisp/faces.el=0A+++=20=
b/lisp/faces.el=0A@@=20-1786,15=20+1786,24=20@@=20=
defined-colors-with-face-attributes=0A=20=0A=20(defun=20=
readable-foreground-color=20(color)=0A=20=20=20"Return=20a=20readable=20=
foreground=20color=20for=20background=20COLOR."=0A-=20=20(let*=20((rgb=20=
=20=20(color-values=20color))=0A-=09=20(max=20=20=20(apply=20#'max=20=
rgb))=0A-=09=20(black=20(car=20(color-values=20"black")))=0A-=09=20=
(white=20(car=20(color-values=20"white"))))=0A-=20=20=20=20;;=20Select=20=
black=20or=20white=20depending=20on=20which=20one=20is=20less=20similar=20=
to=0A-=20=20=20=20;;=20the=20brightest=20component.=0A-=20=20=20=20(if=20=
(>=20(abs=20(-=20max=20black))=20(abs=20(-=20max=20white)))=0A-=09=
"black"=0A-=20=20=20=20=20=20"white")))=0A+=20=20(if=20(color-dark-p=20=
(color-name-to-rgb=20color))=20"white"=20"black"))=0A+=0A+(defun=20=
color-dark-p=20(rgb)=0A+=20=20"Whether=20RGB=20is=20more=20readable=20=
against=20white=20than=20black.=0A+RGB=20is=20a=203-element=20list=20(R=20=
G=20B),=20each=20component=20in=20the=20range=20[0,1]."=0A+=20=20(let*=20=
((sr=20(nth=200=20rgb))=0A+=20=20=20=20=20=20=20=20=20(sg=20(nth=201=20=
rgb))=0A+=20=20=20=20=20=20=20=20=20(sb=20(nth=202=20rgb))=0A+=20=20=20=20=
=20=20=20=20=20;;=20Use=20the=20power=202.2=20as=20an=20approximation=20=
to=20sRGB=20gamma;=0A+=20=20=20=20=20=20=20=20=20;;=20it=20should=20be=20=
good=20enough=20for=20the=20purpose=20of=20this=20function.=0A+=20=20=20=20=
=20=20=20=20=20(r=20(expt=20sr=202.2))=0A+=20=20=20=20=20=20=20=20=20(g=20=
(expt=20sg=202.2))=0A+=20=20=20=20=20=20=20=20=20(b=20(expt=20sb=20=
2.2)))=0A+=20=20=20=20(unless=20(<=3D=200=20(min=20r=20g=20b)=20(max=20r=20=
g=20b)=201)=0A+=20=20=20=20=20=20(error=20"RGB=20components=20%S=20not=20=
in=20[0,1]"=20rgb))=0A+=20=20=20=20;;=20The=20cut-off=20value=20was=20=
determined=20experimentally;=20see=20bug#41544.=0A+=20=20=20=20(<=20(+=20=
(*=20r=200.299)=20(*=20g=200.587)=20(*=20b=200.114))=0A+=20=20=20=20=20=20=
=20(eval-when-compile=20(expt=200.6=202.2)))))=0A=20=0A=20=
(declare-function=20xw-color-defined-p=20"xfns.c"=20(color=20&optional=20=
frame))=0A=20=0Adiff=20--git=20a/lisp/frame.el=20b/lisp/frame.el=0Aindex=20=
6c2f774709..253528da75=20100644=0A---=20a/lisp/frame.el=0A+++=20=
b/lisp/frame.el=0A@@=20-1156,6=20+1156,13=20@@=20frame-background-mode=0A=
=20=0A=20(defvar=20inhibit-frame-set-background-mode=20nil)=0A=20=0A=
+(defun=20frame--color-name-to-rgb=20(color=20frame)=0A+=20=20"Convert=20=
the=20COLOR=20string=20to=20a=20list=20of=20normalised=20RGB=20=
components.=0A+Like=20`color-name-to-rgb',=20but=20works=20even=20when=20=
the=20display=20has=20not=20yet=0A+been=20initialised."=0A+=20=20(let=20=
((valmax=20(if=20(eq=20(framep-on-display=20frame)=20'ns)=2065280.0=20=
65535.0)))=0A+=20=20=20=20(mapcar=20(lambda=20(x)=20(/=20x=20valmax))=20=
(color-values=20color=20frame))))=0A+=0A=20(defun=20=
frame-set-background-mode=20(frame=20&optional=20keep-face-specs)=0A=20=20=
=20"Set=20up=20display-dependent=20faces=20on=20FRAME.=0A=20=
Display-dependent=20faces=20are=20those=20which=20have=20different=20=
definitions=0A@@=20-1181,13=20+1188,9=20@@=20frame-set-background-mode=0A=
=20=09=09=20=20=20non-default-bg-mode)=0A=20=09=09=20=20((not=20=
(color-values=20bg-color=20frame))=0A=20=09=09=20=20=20default-bg-mode)=0A=
-=09=09=20=20((>=3D=20(apply=20'+=20(color-values=20bg-color=20frame))=0A=
-=09=09=20=20=20=20=20=20=20;;=20Just=20looking=20at=20the=20screen,=20=
colors=20whose=0A-=09=09=20=20=20=20=20=20=20;;=20values=20add=20up=20to=20=
.6=20of=20the=20white=20total=0A-=09=09=20=20=20=20=20=20=20;;=20still=20=
look=20dark=20to=20me.=0A-=09=09=20=20=20=20=20=20=20(*=20(apply=20'+=20=
(color-values=20"white"=20frame))=20.6))=0A-=09=09=20=20=20'light)=0A-=09=
=09=20=20(t=20'dark)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20((color-dark-p=20(frame--color-name-to-rgb=20bg-color=20frame))=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'dark)=0A+=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(t=20'light)))=0A=20=09=20=
=20=20(display-type=0A=20=09=20=20=20=20(cond=20((null=20(window-system=20=
frame))=0A=20=09=09=20=20=20(if=20(tty-display-color-p=20frame)=20'color=20=
'mono))=0Adiff=20--git=20a/lisp/term/pc-win.el=20b/lisp/term/pc-win.el=0A=
index=2076a48a86c7..16eb660f00=20100644=0A---=20a/lisp/term/pc-win.el=0A=
+++=20b/lisp/term/pc-win.el=0A@@=20-54,11=20+54,9=20@@=0A=20;;=20=
DJGPP-compiled=20Emacs=20on=20the=20same=20PC.=20=20The=20names=20of=20X=20=
colors=20used=20to=0A=20;;=20define=20the=20pixel=20values=20are=20shown=20=
as=20comments=20to=20each=20color=20below.=0A=20;;;=0A-;;=20If=20you=20=
want=20to=20change=20the=20RGB=20values,=20keep=20in=20mind=20that=20=
various=20pieces=0A-;;=20of=20Emacs=20think=20that=20a=20color=20whose=20=
RGB=20values=20add=20up=20to=20less=20than=200.6=20of=0A-;;=20the=20=
values=20for=20WHITE=20(i.e.=20less=20than=20117963)=20are=20``dark'',=20=
otherwise=20the=0A-;;=20color=20is=20``light'';=20see=20=
`frame-set-background-mode'=20in=20lisp/faces.el=20for=0A-;;=20an=20=
example.=0A+;;=20If=20you=20want=20to=20change=20the=20RGB=20values,=20=
consider=20the=20heuristics=20in=0A+;;=20`color-dark-p'=20which=20is=20=
used=20to=20select=20a=20suitably=20contrasting=0A+;;=20foreground=20or=20=
background=20colour.=0A=20(defvar=20msdos-color-values=0A=20=20=20=
'(("black"=20=20=20=20=20=20=20=20=20=200=20=20=20=20=200=20=20=20=20=20=
0=20=20=20=20=200)=0A=20=20=20=20=20("blue"=20=20=20=20=20=20=20=20=20=20=
=201=20=20=20=20=200=20=20=20=20=200=2052480)=20;=20MediumBlue=0Adiff=20=
--git=20a/lisp/term/rxvt.el=20b/lisp/term/rxvt.el=0Aindex=20=
31e3d6ede4..5dc754c8e0=20100644=0A---=20a/lisp/term/rxvt.el=0A+++=20=
b/lisp/term/rxvt.el=0A@@=20-206,13=20+206,11=20@@=20=
rxvt-set-background-mode=0A=20=20=20=20=20=20=20;;=20The=20next=20line=20=
assumes=20that=20rxvt-standard-colors=20are=20ordered=0A=20=20=20=20=20=20=
=20;;=20by=20the=20color=20index=20in=20the=20ascending=20order!=0A=20=20=
=20=20=20=20=20(setq=20rgb=20(car=20(cddr=20(nth=20bg=20=
rxvt-standard-colors))))=0A-=20=20=20=20=20=20;;=20See=20the=20=
commentary=20in=20frame-set-background-mode=20about=20the=0A-=20=20=20=20=
=20=20;;=20computation=20below.=0A-=20=20=20=20=20=20(if=20(<=20(apply=20=
'+=20rgb)=0A-=09=20=20=20=20=20;;=20The=20following=20line=20assumes=20=
that=20white=20is=20the=2015th=0A-=09=20=20=20=20=20;;=20color=20in=20=
rxvt-standard-colors.=0A-=09=20=20=20=20=20(*=20(apply=20'+=20(car=20=
(cddr=20(nth=2015=20rxvt-standard-colors))))=200.6))=0A-=09=20=20=
(set-terminal-parameter=20nil=20'background-mode=20'dark)))))=0A+=20=20=20=
=20=20=20;;=20The=20following=20line=20assumes=20that=20white=20is=20the=20=
15th=0A+=20=20=20=20=20=20;;=20color=20in=20rxvt-standard-colors.=0A+=20=20=
=20=20=20=20(let=20((comp-max=20(float=20(caddr=20(nth=2015=20=
rxvt-standard-colors)))))=0A+=20=20=20=20=20=20=20=20(when=20=
(color-dark-p=20(mapcar=20(lambda=20(c)=20(/=20c=20comp-max))=20rgb))=0A=
+=09=20=20(set-terminal-parameter=20nil=20'background-mode=20'dark))))))=0A=
=20=0A=20(provide=20'term/rxvt)=0A=20=0Adiff=20--git=20=
a/lisp/term/w32console.el=20b/lisp/term/w32console.el=0Aindex=20=
36e9d896c7..0e9d7c8b5c=20100644=0A---=20a/lisp/term/w32console.el=0A+++=20=
b/lisp/term/w32console.el=0A@@=20-86,9=20+86,9=20@@=20=
terminal-init-w32console=0A=20=20=20=20=20(setq=20r=20(nth=202=20descr)=0A=
=20=09=20=20g=20(nth=203=20descr)=0A=20=09=20=20b=20(nth=204=20descr))=0A=
-=20=20=20=20(if=20(<=20(+=20r=20g=20b)=20(*=20.6=20(+=2065535=2065535=20=
65535)))=0A-=09(setq=20bg-mode=20'dark)=0A-=20=20=20=20=20=20(setq=20=
bg-mode=20'light))=0A+=20=20=20=20(setq=20bg-mode=20(if=20(color-dark-p=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(list=20(/=20r=2065535.0)=20(/=20g=2065535.0)=20(/=20b=2065535.0)))=0A+=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'dark=20=
'light))=0A=20=20=20=20=20(set-terminal-parameter=20nil=20=
'background-mode=20bg-mode))=0A=20=20=20(tty-set-up-initial-frame-faces)=0A=
=20=20=20(run-hooks=20'terminal-init-w32-hook))=0Adiff=20--git=20=
a/lisp/term/xterm.el=20b/lisp/term/xterm.el=0Aindex=20=
1a727e3933..bf9bcae526=20100644=0A---=20a/lisp/term/xterm.el=0A+++=20=
b/lisp/term/xterm.el=0A@@=20-1120,9=20+1120,8=20@@=20=
xterm-register-default-colors=0A=20=20=20=20=20(clear-face-cache)))=0A=20=
=0A=20(defun=20xterm-maybe-set-dark-background-mode=20(redc=20greenc=20=
bluec)=0A-=20=20;;=20Use=20the=20heuristic=20in=20=
`frame-set-background-mode'=20to=20decide=20if=20a=0A-=20=20;;=20frame=20=
is=20dark.=0A-=20=20(when=20(<=20(+=20redc=20greenc=20bluec)=20(*=20.6=20=
(+=2065535=2065535=2065535)))=0A+=20=20(when=20(color-dark-p=20(mapcar=20=
(lambda=20(c)=20(/=20c=2065535.0))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(list=20redc=20=
greenc=20bluec)))=0A=20=20=20=20=20(set-terminal-parameter=20nil=20=
'background-mode=20'dark)=0A=20=20=20=20=20t))=0A=20=0Adiff=20--git=20=
a/lisp/textmodes/css-mode.el=20b/lisp/textmodes/css-mode.el=0Aindex=20=
0035c5e7b0..2cd99787e8=20100644=0A---=20a/lisp/textmodes/css-mode.el=0A=
+++=20b/lisp/textmodes/css-mode.el=0A@@=20-1149,17=20+1149,6=20@@=20=
css--compute-color=0A=20=20=20=20;;=20Evaluate=20to=20the=20color=20if=20=
the=20name=20is=20found.=0A=20=20=20=20((css--named-color=20start-point=20=
match))))=0A=20=0A-(defun=20css--contrasty-color=20(name)=0A-=20=20=
"Return=20a=20color=20that=20contrasts=20with=20NAME.=0A-NAME=20is=20of=20=
any=20form=20accepted=20by=20`color-distance'.=0A-The=20returned=20color=20=
will=20be=20usable=20by=20Emacs=20and=20will=20contrast=0A-with=20NAME;=20=
in=20particular=20so=20that=20if=20NAME=20is=20used=20as=20a=20=
background=0A-color,=20the=20returned=20color=20can=20be=20used=20as=20=
the=20foreground=20and=20still=0A-be=20readable."=0A-=20=20;;=20See=20=
bug#25525=20for=20a=20discussion=20of=20this.=0A-=20=20(if=20(>=20=
(color-distance=20name=20"black")=20292485)=0A-=20=20=20=20=20=20"black"=20=
"white"))=0A-=0A=20(defcustom=20css-fontify-colors=20t=0A=20=20=20=
"Whether=20CSS=20colors=20should=20be=20fontified=20using=20the=20color=20=
as=20the=20background.=0A=20When=20non-`nil',=20a=20text=20representing=20=
CSS=20color=20will=20be=20fontified=0A@@=20-1199,7=20+1188,8=20@@=20=
css--fontify-region=0A=20=09=09=20=20=20=20(add-text-properties=0A=20=09=09=
=20=20=20=20=20start=20(point)=0A=20=09=09=20=20=20=20=20(list=20'face=20=
(list=20:background=20color=0A-=09=09=09=09=20=20=20=20=20=20=20=
:foreground=20(css--contrasty-color=20color)=0A+=09=09=09=09=20=20=20=20=20=
=20=20:foreground=20(readable-foreground-color=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20color)=0A=20=09=09=
=09=09=20=20=20=20=20=20=20:box=20'(:line-width=20-1))))))))))))=0A=20=20=
=20=20=20extended-region))=0A=20=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A=
=0A=

--Apple-Mail=_DB782CBA-D227-410A-B6EF-143B5FD5022B--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 6 Jun 2020 13:57:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 06 09:57:55 2020
Received: from localhost ([127.0.0.1]:52251 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhZKd-00073h-Ep
	for submit <at> debbugs.gnu.org; Sat, 06 Jun 2020 09:57:55 -0400
Received: from eggs.gnu.org ([209.51.188.92]:57668)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jhZKb-00073T-NT
 for 41544 <at> debbugs.gnu.org; Sat, 06 Jun 2020 09:57:53 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:60550)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jhZKW-0005o0-4R; Sat, 06 Jun 2020 09:57:48 -0400
Received: from [176.228.60.248] (port=4660 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jhZKU-0004n0-GX; Sat, 06 Jun 2020 09:57:47 -0400
Date: Sat, 06 Jun 2020 16:57:38 +0300
Message-Id: <83img48ffx.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Sat, 6 Jun 2020 15:29:31 +0200)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN> <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN> <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
 <83r1us8kw6.fsf@HIDDEN> <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41544
Cc: 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Mattias EngdegÄrd <mattiase@HIDDEN>
> Date: Sat, 6 Jun 2020 15:29:31 +0200
> Cc: 41544 <at> debbugs.gnu.org
> 
> 6 juni 2020 kl. 13.59 skrev Eli Zaretskii <eliz@HIDDEN>:
> 
> > I have already pointed out the negative consequences: the fix you
> > proposed changes the behavior and return values of a low-level API
> > that is used in many places, both directly and indirectly. Thus, it
> > runs a high risk of producing bugs and breaking code that works well
> > enough now.
> 
> This is very speculative and hypothetical. Forgive me for being sceptical, but can you come up with a concrete and realistic example of what you think will break?

None at this time.  But bitter experience has taught me that they will
almost certainly come.  They always do.

> > My assumption is that making changes for purely academic and/or
> > aesthetic reasons is something that we should avoid.
> 
> That is a rather disparaging way of referring to fixes intended to make code working as advertised. 

If the problem is that the documentation doesn't match the behavior,
it is much easier for me to agree to amend the documentation.  In this
case, I think a Lisp program that interprets the documentation too
literally is making a mistake, but I'm not opposed to make that
clearer in the docs.

> > I don't even understand what each paragraph above tries to say, and/or
> > with what argument of mine it attempts to argue.
> 
> You were saying that #ffffffffffff is as good an approximation as any other, and I was showing that it's not.

Then I'm not convinced, sorry.

> > Specifically, what is there that is the current state of affairs, what
> > is that _should_be_ the state of affairs
> 
> The current state of affairs is that 'color-values' returns an incorrect value in certain cases. This can be fixed by making the code simpler and more robust.

We've made a full circle: I was talking about the effects on the
callers of color-values and color-name-to-rgb, and explicitly asked
that we don't limit ourselves to these functions alone.  If there are
no problems caused to the callers of these functions, then I think we
should leave the code alone.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 6 Jun 2020 13:29:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 06 09:29:41 2020
Received: from localhost ([127.0.0.1]:51068 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhYtJ-0003wI-B2
	for submit <at> debbugs.gnu.org; Sat, 06 Jun 2020 09:29:41 -0400
Received: from mail157c50.megamailservers.eu ([91.136.10.167]:51618
 helo=mail51c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jhYtE-0003w7-DF
 for 41544 <at> debbugs.gnu.org; Sat, 06 Jun 2020 09:29:40 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591450174;
 bh=Q7L2t01bzD0Gp9w1YwDcKsQOepa8E7GDWP8E9rDiShg=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=Ijug6IQocfRjcN3FQHaCwokrEyd51NhWfwgnsytsnw8J6gXSH05eGKM4hKRgoa92K
 PH03gPEbKm9YBqoJmJT3QPUfXWRepb4S4+7e0FZ5eMFA4N+SykUjpUcvIV2vS2YUAO
 B/2BUJiUseiN2ZcjZXYCt4GCXDCluU5GhjTwhqKM=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail51c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 056DTWI6030485; 
 Sat, 6 Jun 2020 13:29:33 +0000
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <83r1us8kw6.fsf@HIDDEN>
Date: Sat, 6 Jun 2020 15:29:31 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <020DE875-14A8-457A-9AE4-AA0925DB8997@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN> <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN> <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
 <83r1us8kw6.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F23.5EDB99C4.000C:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=MOMeZ/Rl c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10
 a=mDV3o1hIAAAA:8 a=IwwuGxysOwN4sJXSbG8A:9 a=CjuIK1q_8ugA:10
 a=_FVE-zBwftR9WsbkzFJk:22
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  6 juni 2020 kl. 13.59 skrev Eli Zaretskii <eliz@HIDDEN>:
 > I have already pointed out the negative consequences: the fix you > proposed
 changes the behavior and return values of a low-level API > that is used
 in many places, both directly and indirectly. Th [...] 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: gnu.org]
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.3 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 41544
Cc: 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

6 juni 2020 kl. 13.59 skrev Eli Zaretskii <eliz@HIDDEN>:

> I have already pointed out the negative consequences: the fix you
> proposed changes the behavior and return values of a low-level API
> that is used in many places, both directly and indirectly. Thus, it
> runs a high risk of producing bugs and breaking code that works well
> enough now.

This is very speculative and hypothetical. Forgive me for being =
sceptical, but can you come up with a concrete and realistic example of =
what you think will break?

> That is, assuming we are still talking about the last patch you
> posted in this matter.

We were specifically talking about fixing the bug in color-name-to-rgb, =
I believe. It is subordinate to the main change, which we have not =
discussed at all. If you like, we could leave color-name-to-rgb alone, =
and we will see whether the change is needed when doing the actual work =
(color-dark-p).

> My assumption is that making changes for purely academic and/or
> aesthetic reasons is something that we should avoid.

That is a rather disparaging way of referring to fixes intended to make =
code working as advertised.=20

> I don't even understand what each paragraph above tries to say, and/or
> with what argument of mine it attempts to argue.

You were saying that #ffffffffffff is as good an approximation as any =
other, and I was showing that it's not.

> Specifically, what is there that is the current state of affairs, what
> is that _should_be_ the state of affairs

The current state of affairs is that 'color-values' returns an incorrect =
value in certain cases. This can be fixed by making the code simpler and =
more robust.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 6 Jun 2020 12:00:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 06 08:00:15 2020
Received: from localhost ([127.0.0.1]:50969 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhXUk-0001f6-QQ
	for submit <at> debbugs.gnu.org; Sat, 06 Jun 2020 08:00:15 -0400
Received: from eggs.gnu.org ([209.51.188.92]:48562)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jhXUi-0001eM-GP
 for 41544 <at> debbugs.gnu.org; Sat, 06 Jun 2020 08:00:13 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:59478)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jhXUd-0003iI-06; Sat, 06 Jun 2020 08:00:07 -0400
Received: from [176.228.60.248] (port=4848 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jhXUX-0005Xp-L4; Sat, 06 Jun 2020 08:00:03 -0400
Date: Sat, 06 Jun 2020 14:59:53 +0300
Message-Id: <83r1us8kw6.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Sat, 6 Jun 2020 12:59:53 +0200)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN> <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN> <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41544
Cc: 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Mattias EngdegÄrd <mattiase@HIDDEN>
> Date: Sat, 6 Jun 2020 12:59:53 +0200
> Cc: 41544 <at> debbugs.gnu.org
> 
> Thank you all the same, but I'd like to fix this bug nevertheless. It is clearly a bug, and I'm one of those writing code calling color-values and thus being affected by it. Of course, if you can show some negative consequence of the suggested fix, then some alternative has to be considered.

I have already pointed out the negative consequences: the fix you
proposed changes the behavior and return values of a low-level API
that is used in many places, both directly and indirectly.  Thus, it
runs a high risk of producing bugs and breaking code that works well
enough now.

That is, assuming we are still talking about the last patch you
posted in this matter.

> Instead of replying point-for-point, which can go on forever, let's try to break the stalemate; we are clearly talking past one another. I'm trying to understand your assumptions, and hope that you will do me the same courtesy.

My assumption is that making changes for purely academic and/or
aesthetic reasons is something that we should avoid.  Time and again
such changes just introduce bugs in other places, wasting our time and
scarce resources, and leaving the overall quality of Emacs is none the
better.  I will therefore object to any low-level changes that don't
fix clear-cut practical problems in some important functionality.

> The values returned from color-values are scaled to a maximum of 65535 for all Emacs displays (except NS). Just because a TTY does not have a 'white' colour with RGB values (65535 65535 65535) does not mean that the scale is somehow different.
> 
> In the case of TERM=xterm-color, the brightest colour (confusingly named "white") is (58853 58853 58853). This doesn't mean that 58853 is the maximum colour component value; it just means that the brightest colour is not pure white but something like a 90% grey, ie (0.9 0.9 0.9) in 1-normalised RGB notation.
> 
> The method of using (color-values "#ffffffffffff") was a clever trick for obtaining the scale factor without having to know exactly what the maximum was for that frame, since parts of Emacs had different ideas of what range to actually use: it was common for some time to convert from 8 to 16 bit/channel by shifting 8 bits to the left. I've read through bug#25890 and bug#24273, as well as poured over the change history, and it seems very clear where this came from.
> 
> However, the back-end code appears much more robust and regular now, and the code can be simplified, as well as avoiding the irregularities occurring with TTYs lacking a pure white colour. Surely there is no harm in that?

Here you again lost me, sorry.  You asked for understanding of your
assumptions, but I cannot glean those assumptions from the text above.
I don't even understand what each paragraph above tries to say, and/or
with what argument of mine it attempts to argue.

Specifically, what is there that is the current state of affairs, what
is that _should_be_ the state of affairs in your opinion (a.k.a. "your
assumptions", I presume), and why what we have now is in your opinion
so bad that we must fix it?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 6 Jun 2020 11:00:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 06 07:00:07 2020
Received: from localhost ([127.0.0.1]:50874 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhWYY-0006L0-Pm
	for submit <at> debbugs.gnu.org; Sat, 06 Jun 2020 07:00:07 -0400
Received: from mail1444c50.megamailservers.eu ([91.136.14.44]:56372
 helo=mail264c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jhWYV-0006JX-Px
 for 41544 <at> debbugs.gnu.org; Sat, 06 Jun 2020 07:00:05 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591441197;
 bh=3396mviELq+yOhmgZNGLlG7HXvBLyK1Pi+qhuA0uLP0=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=RuLbfhUPbaGVBBIyROSpVvHFYUIpzAdiBvrI/x/VjrdSzJNpCEzghdRyTgLgefGiM
 ahgSly/5YGjihLqI2BL2p5hPFJM/O+AqzEdkWPvv5Haxn1B2fuK8So69TjZK3K6kUz
 mtM7v4fxESf/mxZe77DqSLnkL3SqVEg5z7vn0j4I=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail264c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 056AxsUb014456; 
 Sat, 6 Jun 2020 10:59:56 +0000
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <838sh0abzz.fsf@HIDDEN>
Date: Sat, 6 Jun 2020 12:59:53 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <CD510955-CF47-4F8C-9F95-C9FFF9791496@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN> <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
 <838sh0abzz.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F27.5EDB76CD.0044:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=PPNxBsiC c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10
 a=mDV3o1hIAAAA:8 a=Ecc4TiwEbbgJAD0glIkA:9 a=CjuIK1q_8ugA:10
 a=_FVE-zBwftR9WsbkzFJk:22
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  [I've left Tom and Simon out of the CC list to spare them
 the noise.] 6 juni 2020 kl. 09.29 skrev Eli Zaretskii <eliz@HIDDEN>: > That
 in itself is not bad, IMO. When I said "in practice", I meant > practical
 problems this causes, and that inevitably involves some > callers of that
 function (and the callers of those callers) t [...] 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: gnu.org]
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.3 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 41544
Cc: 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

[I've left Tom and Simon out of the CC list to spare them the noise.]

6 juni 2020 kl. 09.29 skrev Eli Zaretskii <eliz@HIDDEN>:

> That in itself is not bad, IMO.  When I said "in practice", I meant
> practical problems this causes, and that inevitably involves some
> callers of that function (and the callers of those callers) that
> suffer problems which show on display or cause incorrect decisions to
> be made in specific Lisp applications.  What you presented are
> theoretical difficulties that IMO don't yet justify any significant
> changes on this level, not by themselves.

Thank you all the same, but I'd like to fix this bug nevertheless. It is =
clearly a bug, and I'm one of those writing code calling color-values =
and thus being affected by it. Of course, if you can show some negative =
consequence of the suggested fix, then some alternative has to be =
considered.

Instead of replying point-for-point, which can go on forever, let's try =
to break the stalemate; we are clearly talking past one another. I'm =
trying to understand your assumptions, and hope that you will do me the =
same courtesy.

The values returned from color-values are scaled to a maximum of 65535 =
for all Emacs displays (except NS). Just because a TTY does not have a =
'white' colour with RGB values (65535 65535 65535) does not mean that =
the scale is somehow different.

In the case of TERM=3Dxterm-color, the brightest colour (confusingly =
named "white") is (58853 58853 58853). This doesn't mean that 58853 is =
the maximum colour component value; it just means that the brightest =
colour is not pure white but something like a 90% grey, ie (0.9 0.9 0.9) =
in 1-normalised RGB notation.

The method of using (color-values "#ffffffffffff") was a clever trick =
for obtaining the scale factor without having to know exactly what the =
maximum was for that frame, since parts of Emacs had different ideas of =
what range to actually use: it was common for some time to convert from =
8 to 16 bit/channel by shifting 8 bits to the left. I've read through =
bug#25890 and bug#24273, as well as poured over the change history, and =
it seems very clear where this came from.

However, the back-end code appears much more robust and regular now, and =
the code can be simplified, as well as avoiding the irregularities =
occurring with TTYs lacking a pure white colour. Surely there is no harm =
in that?





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 6 Jun 2020 07:29:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 06 03:29:31 2020
Received: from localhost ([127.0.0.1]:50584 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhTGc-0004x9-2L
	for submit <at> debbugs.gnu.org; Sat, 06 Jun 2020 03:29:31 -0400
Received: from eggs.gnu.org ([209.51.188.92]:56104)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jhTGa-0004wx-DD
 for 41544 <at> debbugs.gnu.org; Sat, 06 Jun 2020 03:29:20 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:57436)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jhTGU-000176-Ai; Sat, 06 Jun 2020 03:29:14 -0400
Received: from [176.228.60.248] (port=3805 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jhTGT-0006o1-DF; Sat, 06 Jun 2020 03:29:13 -0400
Date: Sat, 06 Jun 2020 10:29:04 +0300
Message-Id: <838sh0abzz.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Fri, 5 Jun 2020 17:50:47 +0200)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN> <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Mattias EngdegÄrd <mattiase@HIDDEN>
> Date: Fri, 5 Jun 2020 17:50:47 +0200
> Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
> 
> > What bad results does this issue cause in practice?
> 
> The immediate bad result is that color-name-to-rgb returns a value that is (a) wrong and (b) outside the range of legal values for that function. Code calling it expect the value to be (a) correct and (b) within the range of legal values.

That in itself is not bad, IMO.  When I said "in practice", I meant
practical problems this causes, and that inevitably involves some
callers of that function (and the callers of those callers) that
suffer problems which show on display or cause incorrect decisions to
be made in specific Lisp applications.  What you presented are
theoretical difficulties that IMO don't yet justify any significant
changes on this level, not by themselves.

> > (Btw, in a GUI session I see (0.0 0.0 1.0), so no problem there.)
> 
> Of course, but this was specifically in terminals where the colour closest to full white isn't.

On such terminals we will always have a problem, because "white" (and
"red" and "blue", and in fact any color specified by its name) is not
well-defined.  Their RGB values depend on external factors and
configurations that we cannot control, like X-level configuration of
the first 8 or 16 xterm colors.

IOW, this problem cannot be solved in principle, and we shouldn't even
try.  We currently have a solution that works "well enough" for those
cases, and I see no reason to make any significant changes in what we
arrived at after a long journey (which started during development of
Emacs 21).

> >> The main problem is trusting "#ffffffffffff" to match a colour with the maximum range.
> > 
> > Why is that a problem, given the color representation we use in Emacs?
> 
> Because there is not always a matching (white) colour that has the maximum component value.

This cannot be helped on a TTY.  Using #ffffffffffff is as good an
approximation as any other, and better than some which we tried in the
past.  I see no reason to make any changes due to this theoretical
issue.

> (1) We know that the maximum colour component value is 65535 or 65280, depending on the platform (display system).
> (2) color-name-to-rgb needs the maximum colour component value in order to normalise the result.
> (3) color-name-to-rgb currently uses (color-values "#ffffffffffff") to obtain the maximum colour component value, but it is not always correct.
> (4) Instead, we can just use 65535 or 65280 right away, which is fast and always correct.

This would make the result dependent on the frame, since the TTY type
can be different for different frames.  That would give rise to new
and exciting bugs, because these APIs currently don't accept a FRAME
argument (adding such an argument, while it can be made
backward-compatible, will take eons to propagate to Lisp code).

Again, I see no justification for such a change.  If we think these
minor deviations from theoretically perfect results may confuse
someone, we can document these pitfalls in any number of words we see
fit.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 5 Jun 2020 15:51:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 05 11:51:01 2020
Received: from localhost ([127.0.0.1]:49635 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhEcW-0000uy-NE
	for submit <at> debbugs.gnu.org; Fri, 05 Jun 2020 11:51:01 -0400
Received: from mail213c50.megamailservers.eu ([91.136.10.223]:32280
 helo=mail194c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jhEcT-0000uk-G5
 for 41544 <at> debbugs.gnu.org; Fri, 05 Jun 2020 11:50:59 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591372250;
 bh=6SrGCdAfxtbqzwTu91mjae0VBmB3/8RJwF/b6pOPHtI=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=FAbvCmx1vukJHA1f0MmvPdo0cY9Y+MLWB6O3xOJVdqtQFfA1EH8Rxk3Xd6LeHI3Zi
 LgwUZVmzTN1UGkZIsYNvPQ3WtJYFDVhQNYpyvKkPifJA7xnLURuz/tH/gcsdXb1OJF
 Kot2QJtHCUQU/Mmb5pLR6t/24FCRADIz+xbxKzOQ=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail194c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 055FolQo028398; 
 Fri, 5 Jun 2020 15:50:49 +0000
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <835zc5bsut.fsf@HIDDEN>
Date: Fri, 5 Jun 2020 17:50:47 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
 <835zc5bsut.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F21.5EDA6969.0073:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=KsozJleN c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10
 a=mDV3o1hIAAAA:8 a=-VOMddSL8ucwYjIa_j4A:9 a=CjuIK1q_8ugA:10
 a=_FVE-zBwftR9WsbkzFJk:22
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

5 juni 2020 kl. 14.27 skrev Eli Zaretskii <eliz@HIDDEN>:

> There's some history to that: see bug#25890.

Thank you very much, that certainly gives some historical perspective!

> What bad results does this issue cause in practice?

The immediate bad result is that color-name-to-rgb returns a value that =
is (a) wrong and (b) outside the range of legal values for that =
function. Code calling it expect the value to be (a) correct and (b) =
within the range of legal values.

> (Btw, in a GUI session I see (0.0 0.0 1.0), so no problem there.)

Of course, but this was specifically in terminals where the colour =
closest to full white isn't.

>> The main problem is trusting "#ffffffffffff" to match a colour with =
the maximum range.
>=20
> Why is that a problem, given the color representation we use in Emacs?

Because there is not always a matching (white) colour that has the =
maximum component value. The example I gave was for TERM=3Dxterm-color, =
where the closest colour is (#xe5e5 #xe5e5 #xe5e5).

Note that this does not mean that the gamut for that terminal is somehow =
normalised with (0xe5e5 0xe5e5 0xe5e5) as perfect white; it is not. It =
is still the case that the maximum component value is either #xffff or =
#xff00; in this case #xffff.

Now, for non-TTY Emacs, we typically have an unlimited number of colours =
and (color-values "#ffffffffffff") returns the expected value. The same =
goes for a TTY where "white" is indeed white and not washed-out grey, =
such as TERM=3Dlinux.

> Sorry, you lost me here.  I don't understand what you are saying here
> and what does that have to do with the problem being discussed.

Let me try again:
(1) We know that the maximum colour component value is 65535 or 65280, =
depending on the platform (display system).
(2) color-name-to-rgb needs the maximum colour component value in order =
to normalise the result.
(3) color-name-to-rgb currently uses (color-values "#ffffffffffff") to =
obtain the maximum colour component value, but it is not always correct.
(4) Instead, we can just use 65535 or 65280 right away, which is fast =
and always correct.

The rest of my argument was merely discarding the possible alternative =
solution of redefining "white" as (255 255 255) for xterm-color.

> yields "(65535 65535 65535)", so I don't think I understand what
> problem you are concerned with here, and how can this cause a crash.

Sorry, I should have been more specific: this condition is present =
earlier, in frame-set-background-mode, before the --eval arguments are =
processed. This only pertains to the main part of the patch, which we =
have not yet discussed. I cannot fault you for being impatient!





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 5 Jun 2020 12:27:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 05 08:27:54 2020
Received: from localhost ([127.0.0.1]:48493 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhBRx-00028I-Si
	for submit <at> debbugs.gnu.org; Fri, 05 Jun 2020 08:27:54 -0400
Received: from eggs.gnu.org ([209.51.188.92]:47600)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jhBRw-000285-1c
 for 41544 <at> debbugs.gnu.org; Fri, 05 Jun 2020 08:27:53 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:35508)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jhBRq-0008R0-CA; Fri, 05 Jun 2020 08:27:46 -0400
Received: from [176.228.60.248] (port=1299 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jhBRd-00066j-RT; Fri, 05 Jun 2020 08:27:44 -0400
Date: Fri, 05 Jun 2020 15:27:22 +0300
Message-Id: <835zc5bsut.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Thu, 4 Jun 2020 17:29:06 +0200)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.1 (---)

> From: Mattias EngdegÄrd <mattiase@HIDDEN>
> Date: Thu, 4 Jun 2020 17:29:06 +0200
> Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
> 
> 1. color-name-to-rgb calls (color-values "#ffffffffffff") as a means to get the range of the colour values.

There's some history to that: see bug#25890.

> 2. With TERM=xterm-color, there are 8 colours. These are assumed to be the 8 first of xterm-standard-colors (xterm.el).
> 3. The colour closest to "#ffffffffffff" is "white", with the values (229 229 229), or translated to 16 bit/channel, (#e5e5 #e5e5 #e5e5) which color-values returns.
> 4. "blue" has the values (0 0 238), or (0 0 #xeeee).
> 5. Thus color-name-to-rgb returns #xeeee/#xe5e5 for the blue channel, or 1.039, which is a clear bug.

What bad results does this issue cause in practice?

(Btw, in a GUI session I see (0.0 0.0 1.0), so no problem there.)

> The main problem is trusting "#ffffffffffff" to match a colour with the maximum range.

Why is that a problem, given the color representation we use in Emacs?

> It could be argued that xterm.el shouldn't use subdued colours when only 8 are present; I didn't go far back in XTerm history to find out. Modern XTerm has default colours 0-7 that correspond to the assumptions of Emacs.
> 
> Since we already document that the colour channel maximum is either 65535 or 65280 depending on platform, taking the very roundabout way of trying to match a sufficiently white colour and using its components is demonstrably unsafe and error-prone, as well as unnecessarily slow. Hence color-component-max in the patch.

Sorry, you lost me here.  I don't understand what you are saying here
and what does that have to do with the problem being discussed.

> This also fixes a different problem: if the display hasn't been initialised fully, such as when running in batch mode, then (color-values "#ffffffffffff") returns nil, and as we shall see later, it may be useful to be able to call color-name-to-rgb at this stage without crashing.

This command:

  emacs -batch --eval "(message \"%s\" (color-name-to-rgb \"white\"))"

yields "(1.0 1.0 1.0)" on my system with today's master branch, and
this command:

  emacs -batch --eval "(message \"%s\" (color-values \"#ffffffffffff\"))"

yields "(65535 65535 65535)", so I don't think I understand what
problem you are concerned with here, and how can this cause a crash.
Please elaborate.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 4 Jun 2020 15:29:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 04 11:29:14 2020
Received: from localhost ([127.0.0.1]:47256 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jgrnt-0006k4-Tc
	for submit <at> debbugs.gnu.org; Thu, 04 Jun 2020 11:29:14 -0400
Received: from mail74c50.megamailservers.eu ([91.136.10.84]:41320
 helo=mail92c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jgrnr-0006jv-Qf
 for 41544 <at> debbugs.gnu.org; Thu, 04 Jun 2020 11:29:12 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591284550;
 bh=vhoSfDx0Wg6U5tW75QwhEcmfdbvvgQmIR5rB3QhC5j4=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=pFzquu8XqCoyMbJjHtagG0KJS9NN3FxRBEap6xaOnuwqbJx7lK1EibyhojYXlPtKr
 u4nyrtEf7pVmi10h/CJT4vLv9jjJbUGu8buEI+k2KfuiZQUOo5XqPzpr2g8nzsq8YH
 9T9IiHdrG2APC7GmA5ScXIERmxGUj/el8o9cMx8Q=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail92c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 054FT6VY004750; 
 Thu, 4 Jun 2020 15:29:08 +0000
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <83o8pyc4bq.fsf@HIDDEN>
Date: Thu, 4 Jun 2020 17:29:06 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
 <83o8pyc4bq.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F1F.5ED912DC.00B2:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=aY8fYigt c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10
 a=mDV3o1hIAAAA:8 a=pfK807lD-pJQ71N_UpEA:9 a=CjuIK1q_8ugA:10
 a=_FVE-zBwftR9WsbkzFJk:22
X-Spam-Score: 1.4 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  4 juni 2020 kl. 16.07 skrev Eli Zaretskii <eliz@HIDDEN>:
 > Let's please discuss each problem in detail (I tried to understand > them
 from the log message you posted, but couldn't find rationale > there). >
 > And in any case, I will prefer solutions that fix [...] 
 Content analysis details:   (1.4 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: gnu.org]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.4 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

4 juni 2020 kl. 16.07 skrev Eli Zaretskii <eliz@HIDDEN>:

> Let's please discuss each problem in detail (I tried to understand
> them from the log message you posted, but couldn't find rationale
> there).
>=20
> And in any case, I will prefer solutions that fix any problems
> locally, not changes in low-level stuff used in many other places,
> because the latter run the risk of introducing new bugs.  As the
> problems are quite minor, AFAICT, solving them in unsafe ways is
> something to be avoided.

I think we agree. There should be nothing unsafe here other than the =
code being replaced, but code should be scrutinised.

> You mean, the component that is 1.0393?  What bad decisions caused
> that, what problems does this small deviation causes in itself?

Yes, this is as good a place to start as any, and the fix for this is a =
good change on its own. It goes something like this:

1. color-name-to-rgb calls (color-values "#ffffffffffff") as a means to =
get the range of the colour values.
2. With TERM=3Dxterm-color, there are 8 colours. These are assumed to be =
the 8 first of xterm-standard-colors (xterm.el).
3. The colour closest to "#ffffffffffff" is "white", with the values =
(229 229 229), or translated to 16 bit/channel, (#e5e5 #e5e5 #e5e5) =
which color-values returns.
4. "blue" has the values (0 0 238), or (0 0 #xeeee).
5. Thus color-name-to-rgb returns #xeeee/#xe5e5 for the blue channel, or =
1.039, which is a clear bug.

The main problem is trusting "#ffffffffffff" to match a colour with the =
maximum range. It could be argued that xterm.el shouldn't use subdued =
colours when only 8 are present; I didn't go far back in XTerm history =
to find out. Modern XTerm has default colours 0-7 that correspond to the =
assumptions of Emacs.

Since we already document that the colour channel maximum is either =
65535 or 65280 depending on platform, taking the very roundabout way of =
trying to match a sufficiently white colour and using its components is =
demonstrably unsafe and error-prone, as well as unnecessarily slow. =
Hence color-component-max in the patch.

This also fixes a different problem: if the display hasn't been =
initialised fully, such as when running in batch mode, then =
(color-values "#ffffffffffff") returns nil, and as we shall see later, =
it may be useful to be able to call color-name-to-rgb at this stage =
without crashing.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 4 Jun 2020 14:07:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 04 10:07:43 2020
Received: from localhost ([127.0.0.1]:47173 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jgqX1-0004la-8k
	for submit <at> debbugs.gnu.org; Thu, 04 Jun 2020 10:07:43 -0400
Received: from eggs.gnu.org ([209.51.188.92]:51956)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jgqWz-0004lN-FN
 for 41544 <at> debbugs.gnu.org; Thu, 04 Jun 2020 10:07:41 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:33343)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jgqWt-0004b1-Hj; Thu, 04 Jun 2020 10:07:35 -0400
Received: from [176.228.60.248] (port=2435 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jgqWs-0006uU-Ka; Thu, 04 Jun 2020 10:07:35 -0400
Date: Thu, 04 Jun 2020 17:07:21 +0300
Message-Id: <83o8pyc4bq.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Wed, 3 Jun 2020 22:08:46 +0200)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN> <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.1 (---)

> From: Mattias EngdegÄrd <mattiase@HIDDEN>
> Date: Wed, 3 Jun 2020 22:08:46 +0200
> Cc: Tom Tromey <tom@HIDDEN>, Simon Pugnet <simon@HIDDEN>,
>         41544 <at> debbugs.gnu.org
> 
> Now about the consolidation of the contrast colour predicate (color-dark-p): as described previously in detail, the current code for doing so in various places is unsatisfactory. For example, some of the methods employed classify #00ff00 as a "dark" colour, leading to suboptimal results. (Try typing #00ff00 in css-mode.)

Let's please discuss each problem in detail (I tried to understand
them from the log message you posted, but couldn't find rationale
there).

And in any case, I will prefer solutions that fix any problems
locally, not changes in low-level stuff used in many other places,
because the latter run the risk of introducing new bugs.  As the
problems are quite minor, AFAICT, solving them in unsafe ways is
something to be avoided.

> There are other bugs that are annoying in themselves, but need to be fixed in order to make progress. Start Emacs in TTY mode with TERM=xterm-color and evaluate (color-name-to-rgb "blue"). Notice how one of the components is greater than 1 -- this is the unfortunate result of several bad decisions.

You mean, the component that is 1.0393?  What bad decisions caused
that, what problems does this small deviation causes in itself?  We
should weigh the gravity of the problems we try to solve here with the
potential of breaking working code elsewhere which relies on these
idiosyncrasies.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 4 Jun 2020 08:57:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 04 04:57:41 2020
Received: from localhost ([127.0.0.1]:45110 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jglgy-0002kQ-Rx
	for submit <at> debbugs.gnu.org; Thu, 04 Jun 2020 04:57:41 -0400
Received: from mail1460c50.megamailservers.eu ([91.136.14.60]:50674
 helo=mail267c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jglgw-0002kB-Ai
 for 41544 <at> debbugs.gnu.org; Thu, 04 Jun 2020 04:57:39 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591261051;
 bh=aOioo3604yYitbPwCyDCM8FeJy47KwL1TmO4dh5puZE=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=AkkBPXt984IzLbvKA8XynZJcx5zx6jejh5fo1eP/+C9hvOP7UKarxrhNQa3/PB9Ph
 qUUwQ3ZFbMmuevNGX8d7NiZ8Lu4Eiy+aN0r8AEZYvjE05N5VnCuzD8t93aS8wyIV1h
 iFILoZX74RFK6YTj0zEqoxgd/hyTu1CNfvvo/ebE=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail267c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0548vRDR011007; 
 Thu, 4 Jun 2020 08:57:29 +0000
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <87k10ngxus.fsf@HIDDEN>
Date: Thu, 4 Jun 2020 10:57:27 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <FD9DCD41-6C27-41EB-9EFB-DDF91EB86961@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <87k10ngxus.fsf@HIDDEN>
To: Simon Pugnet <simon@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F22.5ED8B701.005B:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=Cf92G4jl c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10
 a=UifCi0nlAAAA:8 a=EJas33KIukAZGsRt7lUA:9 a=CjuIK1q_8ugA:10
 a=4HoP0KxMpNvwstRnlwcE:22
X-Spam-Score: 1.4 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: 4 juni 2020 kl. 08.15 skrev Simon Pugnet
 <simon@HIDDEN>:
 > I just noticed that the patch and commit
 7e8c1a671872ef8e45057f25912594cf548639ab
 to master both reference the bug incorrectly in test/src/xfaces-tests.el.
 The comment under the new test is "Check s [...] 
 Content analysis details:   (1.4 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: megamailservers.eu]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.4 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 41544
Cc: Eli Zaretskii <eliz@HIDDEN>, tom@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

4 juni 2020 kl. 08.15 skrev Simon Pugnet <simon@HIDDEN>:

> I just noticed that the patch and commit =
7e8c1a671872ef8e45057f25912594cf548639ab to master both reference the =
bug incorrectly in test/src/xfaces-tests.el. The comment under the new =
test is "Check symmetry (bug#51455)" however the bug ID is 41544.

Thanks, fixed.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 4 Jun 2020 08:35:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 04 04:35:29 2020
Received: from localhost ([127.0.0.1]:45090 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jglLV-0002Cr-A4
	for submit <at> debbugs.gnu.org; Thu, 04 Jun 2020 04:35:29 -0400
Received: from mail-wr1-f49.google.com ([209.85.221.49]:37853)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <simon.pugnet@HIDDEN>) id 1jgjAc-0007FM-RH
 for 41544 <at> debbugs.gnu.org; Thu, 04 Jun 2020 02:16:07 -0400
Received: by mail-wr1-f49.google.com with SMTP id x13so4727463wrv.4
 for <41544 <at> debbugs.gnu.org>; Wed, 03 Jun 2020 23:16:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:references:user-agent:from:to:cc:subject:in-reply-to:date
 :message-id:mime-version;
 bh=xYnd9YOqhDKnL5B0JSkg6Pv1Nuup0wKTcQ56pr8Wusk=;
 b=dQ7VBvfrJ8C9WwYgZjINk6ku/848Lz/gFmxhBy/h4xppQjvX4O7DLwHRSN/Xkvi5kt
 0uHWEXRYYP7PVSU9uoCrnqi2kzO9alzAO1OFIRG8UNsUZfHeEy3rRcSAtWaWAXww7Oot
 UEYxCLEg4L6DkXiorS7aI3gQ5pO7h83c3eYRA3gWTHBL/Lia3I/NJNdNbn903Cicdm2Q
 w6jG7lyJdIUDNnMwgMY0frf7qxloCmW76EAdm7Shm+t+iTovJaOFn+9M8JZC6nGllKxt
 Mqqz/h+raP+b6r4F6piXNARkzNuK1oLEtricaMygyu2NV2yfyqilTHL32ilLJzHHVgwx
 KSMw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:references:user-agent:from:to:cc:subject
 :in-reply-to:date:message-id:mime-version;
 bh=xYnd9YOqhDKnL5B0JSkg6Pv1Nuup0wKTcQ56pr8Wusk=;
 b=GY2qovh8aPJpnqvH/SrwktoiDvHLBenuuSihNzIIhoXjBAAr+27Zn7IGzEHIgQeOvg
 eiPXnexV9lCM3iYZJGXtmltXxAs8OLWqzvBM2kvoxuW2PtjRYGyDzikj2zsi2uEqgaMA
 epPSJo3dEleZQwdXkOJXLPPeoeCsQn5d1RjWqaIfh3sAzkJA1lh+DXekvt6xfS8LMys4
 AClQ0XSDUH2WObJKUCmKzRxuccCVaAK/naAsDIIsYcp1pzwFqeacjJheIDI7fl5irmwE
 YRm4ccPYXb83NmSqQAu1M1vgIuKthPpmCISh7Nj7jBsXfnvp5TawTmyqh1Vu4/zKlX7j
 1ZHw==
X-Gm-Message-State: AOAM532V2RxfwHbL/fAqpbI07GNx9TFthwozH/13EPTcxnscMT39k3Wk
 kD4/0skzI0gNJW51gO4RxSKEcCbnTCE=
X-Google-Smtp-Source: ABdhPJytrl6eLZpYmd0lql9CGLXYVByK3+WbHuBZOgN21jjwK05ow3xrCY7T5V1Wopp9xzRY+5Oevw==
X-Received: by 2002:adf:dc8e:: with SMTP id r14mr2599753wrj.333.1591251360744; 
 Wed, 03 Jun 2020 23:16:00 -0700 (PDT)
Received: from karnak (141-136-153-177.dsl.iskon.hr. [141.136.153.177])
 by smtp.gmail.com with ESMTPSA id i3sm6360142wrm.83.2020.06.03.23.15.58
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 03 Jun 2020 23:15:59 -0700 (PDT)
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
User-agent: mu4e 1.2.0; emacs 26.3
From: Simon Pugnet <simon@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
In-reply-to: <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
Date: Thu, 04 Jun 2020 07:15:55 +0100
Message-ID: <87k10ngxus.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 41544
X-Mailman-Approved-At: Thu, 04 Jun 2020 04:35:28 -0400
Cc: Eli Zaretskii <eliz@HIDDEN>, tom@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

--=-=-=
Content-Type: text/plain; format=flowed

> Very well, it is obviously an improvement. The reason for the 
> current asymmetry was actually that the algorithm discarded the 
> low bits; what about fixing that as well? The improved accuracy 
> amounts to less than 1 % of difference in the return value; no 
> other code needs changing, and we get the symmetry for free. 
> Proposed patch attached.

Firstly, Mattias and Eli, thank you both for investigating and 
dealing with this bug so quickly and thoroughly.

I just noticed that the patch and commit 
7e8c1a671872ef8e45057f25912594cf548639ab to master both reference 
the bug incorrectly in test/src/xfaces-tests.el. The comment under 
the new test is "Check symmetry (bug#51455)" however the bug ID is 
41544.

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEO/eF3hYsAMj7Tab9uhNZqCwLPvkFAl7YkZsACgkQuhNZqCwL
Pvk4bQ/+PH7d6d4S8fked/BaG5wrfDyc5YmaZGIMQhdllk8ghuxmTZ8fT52dZ/w5
Bhb+/+TP3Ht4p/q3HG5uKm584WFPMtDJABy+umP8KUgA1U/XKa+3uHf1QhN1CBQn
Q97pqZ/kM4Q25lcUVvCdRRX3JMPp0r2cUYk9dTq9V++HLxSIiozyah2aO8oXvC1M
rbNKCII4a4tVioTjgJ0035fxmERAvG+BxSlukhn953kcUvBGco9V3ZI5tgg/ZJxK
JQsdycz8fnd+UR+ZVEBtM0yiH5v4KuyIG3B/S3upq9SFl4QO5SDpiffL3TAnU9CP
8gkn0OUqhTPhjTskAwHM46L6G9xteIhB8AJB3UzT5WczYlYMpeTf/M7h5zbeap5W
v7ijgCARZX2QetwcdInQDQSzSqKrzU7OcZENvHY1sYpMglLK96UqMUOGge7Un5am
UuKZEvWAlR1HpKdIyBruVWu0rGznfmsX3Xtef3hTUZD3mkmXh9qxGD42SHE732rn
XtHS3Fzvap+HBk/N0mnZdMlDYyR+8jE1V1PniaU3ZOgp4Ozvna52hi5rqrzz6WAE
9mxmsrEpV4AhYs+zDZNvjkulGJMc9uayzA19A91IAByKEenrXvymDTiY9Eop6b3V
k6ndjCH17XfYxnzfEihCnNa/iAgBx8gJRpbHxu8w9K3kQrZIEvo=
=6bM1
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 3 Jun 2020 20:09:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 03 16:09:01 2020
Received: from localhost ([127.0.0.1]:44604 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jgZh6-00010z-8v
	for submit <at> debbugs.gnu.org; Wed, 03 Jun 2020 16:09:01 -0400
Received: from mail1450c50.megamailservers.eu ([91.136.14.50]:58488
 helo=mail265c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jgZh3-00010i-4j
 for 41544 <at> debbugs.gnu.org; Wed, 03 Jun 2020 16:08:58 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591214930;
 bh=VXRY4nZ1v/WVsQgi2nckWUmQ57pZbckp5Au97+Hfj3w=;
 h=From:Subject:Date:In-Reply-To:Cc:To:References:From;
 b=e4zxEn/xUpFzPXawNEFUOv0LmtV7YR6e9R00vMrZHccEI1gHPCa4sIKC8CSrrupEb
 BrJZRFWGo3p565i/gbSKUdihlO2vnTUEZAmE6GnutfQul4MbL3YoobOEVPFxmiQpe3
 n2NABf/22LDIACCsrNr+67pQ9yjNuC6+gdqMb9vc=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail265c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 053K8kT7016642; 
 Wed, 3 Jun 2020 20:08:48 +0000
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Message-Id: <624D7FB8-A836-4A7E-8895-47E867214504@HIDDEN>
Content-Type: multipart/mixed;
 boundary="Apple-Mail=_7AF097D7-D9EE-4CBA-891D-80A035FB968B"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
Date: Wed, 3 Jun 2020 22:08:46 +0200
In-Reply-To: <83367ccf8w.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
 <83367ccf8w.fsf@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F28.5ED802FF.003B:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=D5w51cZj c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=M51BFTxLslgA:10 a=mDV3o1hIAAAA:8
 a=vWmk6DFq9m4vw4mpYXoA:9 a=CjuIK1q_8ugA:10 a=BcT7ibRjUQrrFaFC1yUA:9
 a=B2y7HmGcmWMA:10 a=_FVE-zBwftR9WsbkzFJk:22
X-Spam-Score: 1.4 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  3 juni 2020 kl. 17.59 skrev Eli Zaretskii <eliz@HIDDEN>:
 > Then I think we should install it. Thank you; pushed to master. 
 Content analysis details:   (1.4 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: gnu.org]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.4 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 41544
Cc: Tom Tromey <tom@HIDDEN>, Simon Pugnet <simon@HIDDEN>,
 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)


--Apple-Mail=_7AF097D7-D9EE-4CBA-891D-80A035FB968B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

3 juni 2020 kl. 17.59 skrev Eli Zaretskii <eliz@HIDDEN>:

> Then I think we should install it.

Thank you; pushed to master.

Now about the consolidation of the contrast colour predicate =
(color-dark-p): as described previously in detail, the current code for =
doing so in various places is unsatisfactory. For example, some of the =
methods employed classify #00ff00 as a "dark" colour, leading to =
suboptimal results. (Try typing #00ff00 in css-mode.)

There are other bugs that are annoying in themselves, but need to be =
fixed in order to make progress. Start Emacs in TTY mode with =
TERM=3Dxterm-color and evaluate (color-name-to-rgb "blue"). Notice how =
one of the components is greater than 1 -- this is the unfortunate =
result of several bad decisions.

The attached patch supersedes the previous one; after staring at colour =
combinations I came to the conclusion that gamma-expansion is a =
necessity, but the exact sRGB composite gamma curve isn't quite =
necessary, and a power of 2.2 is close enough.

It also uses a contrasting text colour for the first column in =
list-colors-display, which serves as a good demonstration of how the =
predicate works for the standard named colours.


--Apple-Mail=_7AF097D7-D9EE-4CBA-891D-80A035FB968B
Content-Disposition: attachment;
	filename=0001-Use-a-single-light-dark-colour-predicate.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="0001-Use-a-single-light-dark-colour-predicate.patch"
Content-Transfer-Encoding: quoted-printable

=46rom=20f328bda216f06dd2daff6098c6d60e128da2ef67=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20=
<mattiase@HIDDEN>=0ADate:=20Sun,=2031=20May=202020=2021:12:46=20+0200=0A=
Subject:=20[PATCH]=20Use=20a=20single=20light/dark=20colour=20predicate=0A=
=0AAdd=20a=20single=20predicate,=20color-dark-p,=20for=20deciding=20=
whether=20a=20colour=0Ais=20more=20readable=20against=20black=20or=20=
white.=20=20Previously=20this=20was=20done=20in=0Adifferent=20ways=20in=20=
several=20places,=20and=20with=20worse=20results.=20=20(Bug#41544)=0A=0A=
*=20lisp/color.el=20(color-name-to-rgb):=20Use=20color-component-max=20=
instead=0Aof=20the=20error-prone=20method=20of=20(color-values=20=
"#ffffffffffff"),=20which=0Awould=20give=20unexpected=20values=20or=20=
outright=20fail=20if=20called=20without=0Aan=20initialised=20display=20=
(as=20in=20batch=20mode).=0A*=20lisp/facemenu.el=20(list-colors-print):=20=
Use=20readable-foreground-color.=0A(color-dark-p,=20=
color-component-max):=20New=20functions.=0A*=20lisp/term/pc-win.el:=20=
Update=20comment.=0A*=20lisp/term/rxvt.el=20(rxvt-set-background-mode):=0A=
*=20lisp/term/w32console.el=20(terminal-init-w32console):=0A*=20=
lisp/term/xterm.el=20(xterm-maybe-set-dark-background-mode):=0A*=20=
lisp/faces.el=20(readable-foreground-color):=0A*=20lisp/frame.el=20=
(frame-set-background-mode):=20Use=20color-dark-p.=0A*=20=
lisp/textmodes/css-mode.el=20(css--contrasty-color):=20Remove.=0A=
(css--fontify-region):=20Use=20color-dark-p.=0A---=0A=20lisp/color.el=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20|=20=204=20+---=0A=20=
lisp/facemenu.el=20=20=20=20=20=20=20=20=20=20=20|=2011=20+++++------=0A=20=
lisp/faces.el=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=2036=20=
+++++++++++++++++++++++++++---------=0A=20lisp/frame.el=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20|=2010=20+++-------=0A=20lisp/term/pc-win.el=20=20=
=20=20=20=20=20=20|=20=208=20+++-----=0A=20lisp/term/rxvt.el=20=20=20=20=20=
=20=20=20=20=20|=2012=20+++++-------=0A=20lisp/term/w32console.el=20=20=20=
=20|=20=205=20++---=0A=20lisp/term/xterm.el=20=20=20=20=20=20=20=20=20|=20=
=205=20++---=0A=20lisp/textmodes/css-mode.el=20|=2014=20++------------=0A=
=209=20files=20changed,=2050=20insertions(+),=2055=20deletions(-)=0A=0A=
diff=20--git=20a/lisp/color.el=20b/lisp/color.el=0Aindex=20=
560631ae66..2385874028=20100644=0A---=20a/lisp/color.el=0A+++=20=
b/lisp/color.el=0A@@=20-50,9=20+50,7=20@@=20color-name-to-rgb=0A=20=
Optional=20argument=20FRAME=20specifies=20the=20frame=20where=20the=20=
color=20is=20to=20be=0A=20displayed.=20=20If=20FRAME=20is=20omitted=20or=20=
nil,=20use=20the=20selected=20frame.=0A=20If=20FRAME=20cannot=20display=20=
COLOR,=20return=20nil."=0A-=20=20;;=20`colors-values'=20maximum=20value=20=
is=20either=2065535=20or=2065280=20depending=20on=20the=0A-=20=20;;=20=
display=20system.=20=20So=20we=20use=20a=20white=20conversion=20to=20get=20=
the=20max=20value.=0A-=20=20(let=20((valmax=20(float=20(car=20=
(color-values=20"#ffffffffffff")))))=0A+=20=20(let=20((valmax=20(float=20=
(color-component-max=20frame))))=0A=20=20=20=20=20(mapcar=20(lambda=20=
(x)=20(/=20x=20valmax))=20(color-values=20color=20frame))))=0A=20=0A=20=
(defun=20color-rgb-to-hex=20=20(red=20green=20blue=20&optional=20=
digits-per-component)=0Adiff=20--git=20a/lisp/facemenu.el=20=
b/lisp/facemenu.el=0Aindex=20b10d874b21..419b76101b=20100644=0A---=20=
a/lisp/facemenu.el=0A+++=20b/lisp/facemenu.el=0A@@=20-621,12=20+621,11=20=
@@=20list-colors-print=0A=20=09=09=09=09=09=09=20(downcase=20b))))))=0A=20=
=09(setq=20color=20(list=20color)))=0A=20=20=20=20=20=20=20(let*=20=
((opoint=20(point))=0A-=09=20=20=20=20=20(color-values=20(color-values=20=
(car=20color)))=0A-=09=20=20=20=20=20(light-p=20(>=3D=20(apply=20'max=20=
color-values)=0A-=09=09=09=20=20(*=20(car=20(color-values=20"white"))=20=
.5))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20(fg=20=
(readable-foreground-color=20(car=20color))))=0A=20=09(insert=20(car=20=
color))=0A=20=09(indent-to=2022)=0A-=09(put-text-property=20opoint=20=
(point)=20'face=20`(:background=20,(car=20color)))=0A+=09=
(put-text-property=20opoint=20(point)=20'face=20`(:background=20,(car=20=
color)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20:foreground=20,fg))=0A=20=09(put-text-property=0A=20=09=20=
(prog1=20(point)=0A=20=09=20=20=20(insert=20"=20")=0A@@=20-639,7=20=
+638,7=20@@=20list-colors-print=0A=20=09(insert=20(propertize=0A=20=09=09=
=20(apply=20'format=20"#%02x%02x%02x"=0A=20=09=09=09(mapcar=20(lambda=20=
(c)=20(ash=20c=20-8))=0A-=09=09=09=09color-values))=0A+=09=09=09=09=
(color-values=20(car=20color))))=0A=20=09=09=20'mouse-face=20'highlight=0A=
=20=09=09=20'help-echo=0A=20=09=09=20(let=20((hsv=20(apply=20=
'color-rgb-to-hsv=0A@@=20-651,7=20+650,7=20@@=20list-colors-print=0A=20=09=
=20=20=20opoint=20(point)=0A=20=09=20=20=20'follow-link=20t=0A=20=09=20=20=
=20'mouse-face=20(list=20:background=20(car=20color)=0A-=09=09=09=20=20=20=
=20=20:foreground=20(if=20light-p=20"black"=20"white"))=0A+=09=09=09=20=20=
=20=20=20:foreground=20fg)=0A=20=09=20=20=20'color-name=20(car=20color)=0A=
=20=09=20=20=20'action=20callback-fn)))=0A=20=20=20=20=20=20=20(insert=20=
"\n"))=0Adiff=20--git=20a/lisp/faces.el=20b/lisp/faces.el=0Aindex=20=
e707f6f4b6..5958427946=20100644=0A---=20a/lisp/faces.el=0A+++=20=
b/lisp/faces.el=0A@@=20-1786,15=20+1786,24=20@@=20=
defined-colors-with-face-attributes=0A=20=0A=20(defun=20=
readable-foreground-color=20(color)=0A=20=20=20"Return=20a=20readable=20=
foreground=20color=20for=20background=20COLOR."=0A-=20=20(let*=20((rgb=20=
=20=20(color-values=20color))=0A-=09=20(max=20=20=20(apply=20#'max=20=
rgb))=0A-=09=20(black=20(car=20(color-values=20"black")))=0A-=09=20=
(white=20(car=20(color-values=20"white"))))=0A-=20=20=20=20;;=20Select=20=
black=20or=20white=20depending=20on=20which=20one=20is=20less=20similar=20=
to=0A-=20=20=20=20;;=20the=20brightest=20component.=0A-=20=20=20=20(if=20=
(>=20(abs=20(-=20max=20black))=20(abs=20(-=20max=20white)))=0A-=09=
"black"=0A-=20=20=20=20=20=20"white")))=0A+=20=20(if=20(color-dark-p=20=
(color-name-to-rgb=20color))=20"white"=20"black"))=0A+=0A+(defun=20=
color-dark-p=20(rgb)=0A+=20=20"Whether=20RGB=20is=20more=20readable=20=
against=20white=20than=20black.=0A+RGB=20is=20a=203-element=20list=20(R=20=
G=20B),=20each=20component=20in=20the=20range=20[0,1]."=0A+=20=20(let*=20=
((sr=20(nth=200=20rgb))=0A+=20=20=20=20=20=20=20=20=20(sg=20(nth=201=20=
rgb))=0A+=20=20=20=20=20=20=20=20=20(sb=20(nth=202=20rgb))=0A+=20=20=20=20=
=20=20=20=20=20;;=20Use=20the=20power=202.2=20as=20an=20approximation=20=
to=20sRGB=20gamma;=0A+=20=20=20=20=20=20=20=20=20;;=20it=20should=20be=20=
good=20enough=20for=20the=20purpose=20of=20this=20function.=0A+=20=20=20=20=
=20=20=20=20=20(r=20(expt=20sr=202.2))=0A+=20=20=20=20=20=20=20=20=20(g=20=
(expt=20sg=202.2))=0A+=20=20=20=20=20=20=20=20=20(b=20(expt=20sb=20=
2.2)))=0A+=20=20=20=20(unless=20(<=3D=200=20(min=20r=20g=20b)=20(max=20r=20=
g=20b)=201)=0A+=20=20=20=20=20=20(error=20"RGB=20components=20%S=20not=20=
in=20[0,1]"=20rgb))=0A+=20=20=20=20;;=20The=20cut-off=20value=20was=20=
determined=20experimentally;=20see=20bug#41544.=0A+=20=20=20=20(<=20(+=20=
(*=20r=200.299)=20(*=20g=200.587)=20(*=20b=200.114))=0A+=20=20=20=20=20=20=
=20(eval-when-compile=20(expt=200.6=202.2)))))=0A=20=0A=20=
(declare-function=20xw-color-defined-p=20"xfns.c"=20(color=20&optional=20=
frame))=0A=20=0A@@=20-1840,6=20+1849,15=20@@=20color-values=0A=20=20=20=20=
(t=0A=20=20=20=20=20(tty-color-values=20color=20frame))))=0A=20=0A=
+(defun=20color-component-max=20(&optional=20frame)=0A+=20=20"The=20=
highest=20value=20of=20a=20color=20component=20on=20FRAME.=0A+If=20FRAME=20=
is=20omitted=20or=20nil,=20use=20the=20selected=20frame."=0A+=20=20;;=20=
Right=20now,=20NS=20frames=20are=20the=20only=20ones=20having=20a=20=
different=20maximum=0A+=20=20;;=20colour=20component=20value.=0A+=20=20=
(if=20(eq=20(framep-on-display=20frame)=20'ns)=0A+=20=20=20=20=20=20=
#xff00=0A+=20=20=20=20#xffff))=0A+=0A=20(defalias=20'x-color-values=20=
'color-values)=0A=20=0A=20(declare-function=20xw-display-color-p=20=
"xfns.c"=20(&optional=20terminal))=0Adiff=20--git=20a/lisp/frame.el=20=
b/lisp/frame.el=0Aindex=206c2f774709..fed46f333d=20100644=0A---=20=
a/lisp/frame.el=0A+++=20b/lisp/frame.el=0A@@=20-1181,13=20+1181,9=20@@=20=
frame-set-background-mode=0A=20=09=09=20=20=20non-default-bg-mode)=0A=20=09=
=09=20=20((not=20(color-values=20bg-color=20frame))=0A=20=09=09=20=20=20=
default-bg-mode)=0A-=09=09=20=20((>=3D=20(apply=20'+=20(color-values=20=
bg-color=20frame))=0A-=09=09=20=20=20=20=20=20=20;;=20Just=20looking=20=
at=20the=20screen,=20colors=20whose=0A-=09=09=20=20=20=20=20=20=20;;=20=
values=20add=20up=20to=20.6=20of=20the=20white=20total=0A-=09=09=20=20=20=
=20=20=20=20;;=20still=20look=20dark=20to=20me.=0A-=09=09=20=20=20=20=20=20=
=20(*=20(apply=20'+=20(color-values=20"white"=20frame))=20.6))=0A-=09=09=20=
=20=20'light)=0A-=09=09=20=20(t=20'dark)))=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20((color-dark-p=20(color-name-to-rgb=20=
bg-color=20frame))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20'dark)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(t=20=
'light)))=0A=20=09=20=20=20(display-type=0A=20=09=20=20=20=20(cond=20=
((null=20(window-system=20frame))=0A=20=09=09=20=20=20(if=20=
(tty-display-color-p=20frame)=20'color=20'mono))=0Adiff=20--git=20=
a/lisp/term/pc-win.el=20b/lisp/term/pc-win.el=0Aindex=20=
76a48a86c7..16eb660f00=20100644=0A---=20a/lisp/term/pc-win.el=0A+++=20=
b/lisp/term/pc-win.el=0A@@=20-54,11=20+54,9=20@@=0A=20;;=20=
DJGPP-compiled=20Emacs=20on=20the=20same=20PC.=20=20The=20names=20of=20X=20=
colors=20used=20to=0A=20;;=20define=20the=20pixel=20values=20are=20shown=20=
as=20comments=20to=20each=20color=20below.=0A=20;;;=0A-;;=20If=20you=20=
want=20to=20change=20the=20RGB=20values,=20keep=20in=20mind=20that=20=
various=20pieces=0A-;;=20of=20Emacs=20think=20that=20a=20color=20whose=20=
RGB=20values=20add=20up=20to=20less=20than=200.6=20of=0A-;;=20the=20=
values=20for=20WHITE=20(i.e.=20less=20than=20117963)=20are=20``dark'',=20=
otherwise=20the=0A-;;=20color=20is=20``light'';=20see=20=
`frame-set-background-mode'=20in=20lisp/faces.el=20for=0A-;;=20an=20=
example.=0A+;;=20If=20you=20want=20to=20change=20the=20RGB=20values,=20=
consider=20the=20heuristics=20in=0A+;;=20`color-dark-p'=20which=20is=20=
used=20to=20select=20a=20suitably=20contrasting=0A+;;=20foreground=20or=20=
background=20colour.=0A=20(defvar=20msdos-color-values=0A=20=20=20=
'(("black"=20=20=20=20=20=20=20=20=20=200=20=20=20=20=200=20=20=20=20=20=
0=20=20=20=20=200)=0A=20=20=20=20=20("blue"=20=20=20=20=20=20=20=20=20=20=
=201=20=20=20=20=200=20=20=20=20=200=2052480)=20;=20MediumBlue=0Adiff=20=
--git=20a/lisp/term/rxvt.el=20b/lisp/term/rxvt.el=0Aindex=20=
31e3d6ede4..ebcb13db77=20100644=0A---=20a/lisp/term/rxvt.el=0A+++=20=
b/lisp/term/rxvt.el=0A@@=20-206,13=20+206,11=20@@=20=
rxvt-set-background-mode=0A=20=20=20=20=20=20=20;;=20The=20next=20line=20=
assumes=20that=20rxvt-standard-colors=20are=20ordered=0A=20=20=20=20=20=20=
=20;;=20by=20the=20color=20index=20in=20the=20ascending=20order!=0A=20=20=
=20=20=20=20=20(setq=20rgb=20(car=20(cddr=20(nth=20bg=20=
rxvt-standard-colors))))=0A-=20=20=20=20=20=20;;=20See=20the=20=
commentary=20in=20frame-set-background-mode=20about=20the=0A-=20=20=20=20=
=20=20;;=20computation=20below.=0A-=20=20=20=20=20=20(if=20(<=20(apply=20=
'+=20rgb)=0A-=09=20=20=20=20=20;;=20The=20following=20line=20assumes=20=
that=20white=20is=20the=2015th=0A-=09=20=20=20=20=20;;=20color=20in=20=
rxvt-standard-colors.=0A-=09=20=20=20=20=20(*=20(apply=20'+=20(car=20=
(cddr=20(nth=2015=20rxvt-standard-colors))))=200.6))=0A-=09=20=20=
(set-terminal-parameter=20nil=20'background-mode=20'dark)))))=0A+=20=20=20=
=20=20=20;;=20The=20following=20line=20assumes=20that=20white=20is=20the=20=
15th=0A+=20=20=20=20=20=20;;=20color=20in=20rxvt-standard-colors.=0A+=20=20=
=20=20=20=20(let=20((comp-max=20(caddr=20(nth=2015=20=
rxvt-standard-colors))))=0A+=20=20=20=20=20=20=20=20(when=20=
(color-dark-p=20(mapcar=20(lambda=20(c)=20(/=20c=20comp-max))=20rgb))=0A=
+=09=20=20(set-terminal-parameter=20nil=20'background-mode=20'dark))))))=0A=
=20=0A=20(provide=20'term/rxvt)=0A=20=0Adiff=20--git=20=
a/lisp/term/w32console.el=20b/lisp/term/w32console.el=0Aindex=20=
36e9d896c7..b249a4e602=20100644=0A---=20a/lisp/term/w32console.el=0A+++=20=
b/lisp/term/w32console.el=0A@@=20-86,9=20+86,8=20@@=20=
terminal-init-w32console=0A=20=20=20=20=20(setq=20r=20(nth=202=20descr)=0A=
=20=09=20=20g=20(nth=203=20descr)=0A=20=09=20=20b=20(nth=204=20descr))=0A=
-=20=20=20=20(if=20(<=20(+=20r=20g=20b)=20(*=20.6=20(+=2065535=2065535=20=
65535)))=0A-=09(setq=20bg-mode=20'dark)=0A-=20=20=20=20=20=20(setq=20=
bg-mode=20'light))=0A+=20=20=20=20(setq=20bg-mode=20(if=20(color-dark-p=20=
(list=20(/=20r=2065535)=20(/=20g=2065535)=20(/=20b=2065535)))=0A+=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'dark=20=
'light))=0A=20=20=20=20=20(set-terminal-parameter=20nil=20=
'background-mode=20bg-mode))=0A=20=20=20(tty-set-up-initial-frame-faces)=0A=
=20=20=20(run-hooks=20'terminal-init-w32-hook))=0Adiff=20--git=20=
a/lisp/term/xterm.el=20b/lisp/term/xterm.el=0Aindex=20=
1a727e3933..bf9bcae526=20100644=0A---=20a/lisp/term/xterm.el=0A+++=20=
b/lisp/term/xterm.el=0A@@=20-1120,9=20+1120,8=20@@=20=
xterm-register-default-colors=0A=20=20=20=20=20(clear-face-cache)))=0A=20=
=0A=20(defun=20xterm-maybe-set-dark-background-mode=20(redc=20greenc=20=
bluec)=0A-=20=20;;=20Use=20the=20heuristic=20in=20=
`frame-set-background-mode'=20to=20decide=20if=20a=0A-=20=20;;=20frame=20=
is=20dark.=0A-=20=20(when=20(<=20(+=20redc=20greenc=20bluec)=20(*=20.6=20=
(+=2065535=2065535=2065535)))=0A+=20=20(when=20(color-dark-p=20(mapcar=20=
(lambda=20(c)=20(/=20c=2065535.0))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(list=20redc=20=
greenc=20bluec)))=0A=20=20=20=20=20(set-terminal-parameter=20nil=20=
'background-mode=20'dark)=0A=20=20=20=20=20t))=0A=20=0Adiff=20--git=20=
a/lisp/textmodes/css-mode.el=20b/lisp/textmodes/css-mode.el=0Aindex=20=
0035c5e7b0..2cd99787e8=20100644=0A---=20a/lisp/textmodes/css-mode.el=0A=
+++=20b/lisp/textmodes/css-mode.el=0A@@=20-1149,17=20+1149,6=20@@=20=
css--compute-color=0A=20=20=20=20;;=20Evaluate=20to=20the=20color=20if=20=
the=20name=20is=20found.=0A=20=20=20=20((css--named-color=20start-point=20=
match))))=0A=20=0A-(defun=20css--contrasty-color=20(name)=0A-=20=20=
"Return=20a=20color=20that=20contrasts=20with=20NAME.=0A-NAME=20is=20of=20=
any=20form=20accepted=20by=20`color-distance'.=0A-The=20returned=20color=20=
will=20be=20usable=20by=20Emacs=20and=20will=20contrast=0A-with=20NAME;=20=
in=20particular=20so=20that=20if=20NAME=20is=20used=20as=20a=20=
background=0A-color,=20the=20returned=20color=20can=20be=20used=20as=20=
the=20foreground=20and=20still=0A-be=20readable."=0A-=20=20;;=20See=20=
bug#25525=20for=20a=20discussion=20of=20this.=0A-=20=20(if=20(>=20=
(color-distance=20name=20"black")=20292485)=0A-=20=20=20=20=20=20"black"=20=
"white"))=0A-=0A=20(defcustom=20css-fontify-colors=20t=0A=20=20=20=
"Whether=20CSS=20colors=20should=20be=20fontified=20using=20the=20color=20=
as=20the=20background.=0A=20When=20non-`nil',=20a=20text=20representing=20=
CSS=20color=20will=20be=20fontified=0A@@=20-1199,7=20+1188,8=20@@=20=
css--fontify-region=0A=20=09=09=20=20=20=20(add-text-properties=0A=20=09=09=
=20=20=20=20=20start=20(point)=0A=20=09=09=20=20=20=20=20(list=20'face=20=
(list=20:background=20color=0A-=09=09=09=09=20=20=20=20=20=20=20=
:foreground=20(css--contrasty-color=20color)=0A+=09=09=09=09=20=20=20=20=20=
=20=20:foreground=20(readable-foreground-color=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20color)=0A=20=09=09=
=09=09=20=20=20=20=20=20=20:box=20'(:line-width=20-1))))))))))))=0A=20=20=
=20=20=20extended-region))=0A=20=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A=
=0A=

--Apple-Mail=_7AF097D7-D9EE-4CBA-891D-80A035FB968B--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 3 Jun 2020 15:59:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 03 11:59:36 2020
Received: from localhost ([127.0.0.1]:44448 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jgVnk-0001PA-Kl
	for submit <at> debbugs.gnu.org; Wed, 03 Jun 2020 11:59:36 -0400
Received: from eggs.gnu.org ([209.51.188.92]:59498)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jgVnf-0001Oq-N5
 for 41544 <at> debbugs.gnu.org; Wed, 03 Jun 2020 11:59:35 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:43880)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jgVnZ-0008RW-Q8; Wed, 03 Jun 2020 11:59:25 -0400
Received: from [176.228.60.248] (port=4347 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jgVnY-00035W-W6; Wed, 03 Jun 2020 11:59:25 -0400
Date: Wed, 03 Jun 2020 18:59:11 +0300
Message-Id: <83367ccf8w.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Wed, 3 Jun 2020 17:01:46 +0200)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN> <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.1 (---)

> From: Mattias EngdegÄrd <mattiase@HIDDEN>
> Date: Wed, 3 Jun 2020 17:01:46 +0200
> Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
> 
> 3 juni 2020 kl. 16.24 skrev Eli Zaretskii <eliz@HIDDEN>:
> 
> > Not sure I understand completely: does this patch make the function
> > symmetric?
> 
> Yes, the patch both improves the accuracy and makes the function symmetric.

Then I think we should install it.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 3 Jun 2020 15:02:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 03 11:02:17 2020
Received: from localhost ([127.0.0.1]:44374 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jgUu3-0008Sq-Lu
	for submit <at> debbugs.gnu.org; Wed, 03 Jun 2020 11:02:17 -0400
Received: from mail1447c50.megamailservers.eu ([91.136.14.47]:35958
 helo=mail265c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jgUtw-0008SG-Rz
 for 41544 <at> debbugs.gnu.org; Wed, 03 Jun 2020 11:02:01 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591196510;
 bh=qWCEGsTS1wd5iS8aIuJ/v7ZVHNt4zb35pXMNUYxgCic=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=JGjguN63LS38L6wWczRnxU5Bwgg8wZm0bhvvbyhjuRqtGN/0j9GXSk8n/9Y3Zpfe5
 HEkbi6ed2wr579CVpaPSC9Seony3IJdigs7f9qRKyLGscVFMqc85gEQ2oiMnz8OxT2
 DiW+G6DpfSpwM+jo8CkaBflYhYKMplNHbVox4yR0=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail265c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 053F1kFD029457; 
 Wed, 3 Jun 2020 15:01:48 +0000
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <83blm0cjlz.fsf@HIDDEN>
Date: Wed, 3 Jun 2020 17:01:46 +0200
Content-Transfer-Encoding: 7bit
Message-Id: <DFEE560C-C8A7-4B8E-B9D1-D2DC37C1034A@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
 <83blm0cjlz.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F25.5ED7BAD3.0039:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=D5w51cZj c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10
 a=mDV3o1hIAAAA:8 a=3qhpsr4axi-On4-2KVYA:9 a=CjuIK1q_8ugA:10
 a=ncZ9vwaUYPMA:10 a=_FVE-zBwftR9WsbkzFJk:22
X-Spam-Score: 0.4 (/)
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

3 juni 2020 kl. 16.24 skrev Eli Zaretskii <eliz@HIDDEN>:

> Not sure I understand completely: does this patch make the function
> symmetric?

Yes, the patch both improves the accuracy and makes the function symmetric.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 3 Jun 2020 14:25:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 03 10:25:22 2020
Received: from localhost ([127.0.0.1]:44304 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jgUKX-0007WS-OT
	for submit <at> debbugs.gnu.org; Wed, 03 Jun 2020 10:25:21 -0400
Received: from eggs.gnu.org ([209.51.188.92]:47660)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jgUKW-0007WE-88
 for 41544 <at> debbugs.gnu.org; Wed, 03 Jun 2020 10:25:20 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:42299)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jgUKQ-00037i-5L; Wed, 03 Jun 2020 10:25:14 -0400
Received: from [176.228.60.248] (port=2586 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jgUKO-0004wq-LX; Wed, 03 Jun 2020 10:25:13 -0400
Date: Wed, 03 Jun 2020 17:24:56 +0300
Message-Id: <83blm0cjlz.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Tue, 2 Jun 2020 22:41:03 +0200)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN> <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.1 (---)

> From: Mattias EngdegÄrd <mattiase@HIDDEN>
> Date: Tue, 2 Jun 2020 22:41:03 +0200
> Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
> 
> > I'd prefer to fix only the symmetry bug (which AFAIU happens because
> > we use bit shifts on signed integers), without introducing any other
> > effects on the function's behavior and return values.  AFAIU, such a
> > fix should not require any changes outside of the function itself.
> 
> Very well, it is obviously an improvement. The reason for the current asymmetry was actually that the algorithm discarded the low bits; what about fixing that as well?

Sure, let's make it as accurate as the return value allows.

> The improved accuracy amounts to less than 1 % of difference in the return value; no other code needs changing, and we get the symmetry for free. Proposed patch attached.

Not sure I understand completely: does this patch make the function
symmetric?  If so, what additional improvements did you have in mind
when you mentioned more fixing above?

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 2 Jun 2020 20:41:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 02 16:41:13 2020
Received: from localhost ([127.0.0.1]:41069 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jgDii-0003Vv-Oi
	for submit <at> debbugs.gnu.org; Tue, 02 Jun 2020 16:41:12 -0400
Received: from mail176c50.megamailservers.eu ([91.136.10.186]:59738
 helo=mail37c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jgDig-0003Vl-7v
 for 41544 <at> debbugs.gnu.org; Tue, 02 Jun 2020 16:41:11 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591130467;
 bh=65fBZE1X9H5Z6AttrJGQrkXW74UtqfGVeugwwgZ3pZI=;
 h=From:Subject:Date:In-Reply-To:Cc:To:References:From;
 b=mmMiqm4hQr/KuDysapK1snlIrhNVfXM3iv2ntHvgTPj9oPKwRqpEIrhNWO58hQAFR
 9Tlm3KuD8H54pG6NIz5Vri4r0alRgMLHjVi5BAORbkux8gosmnX7dCojfo+lpjED6g
 ZKdYSYyY9rElagC0x6rIvs3qwIalgkzAOMtgvW84=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail37c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 052Kf3bL029641; 
 Tue, 2 Jun 2020 20:41:05 +0000
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Message-Id: <B671DFD8-FE47-4AE5-9F55-DD0652BB2F2F@HIDDEN>
Content-Type: multipart/mixed;
 boundary="Apple-Mail=_9A3622FA-6DF5-4FB7-9BFE-40A69D391DCB"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
Date: Tue, 2 Jun 2020 22:41:03 +0200
In-Reply-To: <83y2p5cumz.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
 <83y2p5cumz.fsf@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F27.5ED6B909.0035:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=bJNo382Z c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=M51BFTxLslgA:10 a=mDV3o1hIAAAA:8
 a=bM8LWKgTAXqvqXeV2bUA:9 a=CjuIK1q_8ugA:10 a=p9XNr_QT056JWQCrFTgA:9
 a=B2y7HmGcmWMA:10 a=_FVE-zBwftR9WsbkzFJk:22
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)


--Apple-Mail=_9A3622FA-6DF5-4FB7-9BFE-40A69D391DCB
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

2 juni 2020 kl. 18.14 skrev Eli Zaretskii <eliz@HIDDEN>:

> I'd prefer to fix only the symmetry bug (which AFAIU happens because
> we use bit shifts on signed integers), without introducing any other
> effects on the function's behavior and return values.  AFAIU, such a
> fix should not require any changes outside of the function itself.

Very well, it is obviously an improvement. The reason for the current =
asymmetry was actually that the algorithm discarded the low bits; what =
about fixing that as well? The improved accuracy amounts to less than 1 =
% of difference in the return value; no other code needs changing, and =
we get the symmetry for free. Proposed patch attached.


--Apple-Mail=_9A3622FA-6DF5-4FB7-9BFE-40A69D391DCB
Content-Disposition: attachment;
	filename=0001-Make-color-distance-symmetric-and-more-accurate.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="0001-Make-color-distance-symmetric-and-more-accurate.patch"
Content-Transfer-Encoding: quoted-printable

=46rom=20b40a56f8be6add33f7de634f0966887622063e43=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20=
<mattiase@HIDDEN>=0ADate:=20Tue,=202=20Jun=202020=2022:31:14=20+0200=0A=
Subject:=20[PATCH]=20Make=20color-distance=20symmetric=20and=20more=20=
accurate=0A=0A*=20src/xfaces.c=20(color_distance):=20Don't=20throw=20=
away=20the=20low=208=20bits=20of=0Athe=20colours,=20and=20make=20the=20=
function=20symmetric=20(bug41544)=0A(Fcolor_distance):=20Add=20caution=20=
about=20this=20not=20being=20a=20true=20metric.=0A*=20=
test/src/xfaces-tests.el:=20New=20file.=0A---=0A=20src/xfaces.c=20=20=20=20=
=20=20=20=20=20=20=20=20=20|=2024=20+++++++++++++-----------=0A=20=
test/src/xfaces-tests.el=20|=2027=20+++++++++++++++++++++++++++=0A=202=20=
files=20changed,=2040=20insertions(+),=2011=20deletions(-)=0A=20create=20=
mode=20100644=20test/src/xfaces-tests.el=0A=0Adiff=20--git=20=
a/src/xfaces.c=20b/src/xfaces.c=0Aindex=207d7aff95c1..cf155288bd=20=
100644=0A---=20a/src/xfaces.c=0A+++=20b/src/xfaces.c=0A@@=20-4356,15=20=
+4356,15=20@@=20color_distance=20(Emacs_Color=20*x,=20Emacs_Color=20*y)=0A=
=20=0A=20=20=20=20=20=20See=20<https://www.compuphase.com/cmetric.htm>=20=
for=20more=20info.=20=20*/=0A=20=0A-=20=20long=20r=20=3D=20(x->red=20=20=20=
-=20y->red)=20=20=20>>=208;=0A-=20=20long=20g=20=3D=20(x->green=20-=20=
y->green)=20>>=208;=0A-=20=20long=20b=20=3D=20(x->blue=20=20-=20y->blue)=20=
=20>>=208;=0A-=20=20long=20r_mean=20=3D=20(x->red=20+=20y->red)=20>>=20=
9;=0A-=0A-=20=20return=0A-=20=20=20=20(((512=20+=20r_mean)=20*=20r=20*=20=
r)=20>>=208)=0A-=20=20=20=20+=204=20*=20g=20*=20g=0A-=20=20=20=20+=20=
(((767=20-=20r_mean)=20*=20b=20*=20b)=20>>=208);=0A+=20=20long=20long=20=
r=20=3D=20x->red=20=20=20-=20y->red;=0A+=20=20long=20long=20g=20=3D=20=
x->green=20-=20y->green;=0A+=20=20long=20long=20b=20=3D=20x->blue=20=20-=20=
y->blue;=0A+=20=20long=20long=20r_mean=20=3D=20(x->red=20+=20y->red)=20=
>>=201;=0A+=0A+=20=20return=20(((((2=20*=2065536=20+=20r_mean)=20*=20r=20=
*=20r)=20>>=2016)=0A+=20=20=20=20=20=20=20=20=20=20=20+=204=20*=20g=20*=20=
g=0A+=20=20=20=20=20=20=20=20=20=20=20+=20(((2=20*=2065536=20+=2065535=20=
-=20r_mean)=20*=20b=20*=20b)=20>>=2016))=0A+=20=20=20=20=20=20=20=20=20=20=
>>=2016);=0A=20}=0A=20=0A=20=0A@@=20-4374,7=20+4374,9=20@@=20DEFUN=20=
("color-distance",=20Fcolor_distance,=20Scolor_distance,=202,=204,=200,=0A=
=20or=20lists=20of=20the=20form=20(RED=20GREEN=20BLUE),=20each=20in=20=
the=20range=200=20to=2065535=20inclusive.=0A=20If=20FRAME=20is=20=
unspecified=20or=20nil,=20the=20current=20frame=20is=20used.=0A=20If=20=
METRIC=20is=20specified,=20it=20should=20be=20a=20function=20that=20=
accepts=0A-two=20lists=20of=20the=20form=20(RED=20GREEN=20BLUE)=20=
aforementioned.=20*/)=0A+two=20lists=20of=20the=20form=20(RED=20GREEN=20=
BLUE)=20aforementioned.=0A+Despite=20the=20name,=20this=20is=20not=20a=20=
true=20distance=20metric=20as=20it=20does=20not=20satisfy=0A+the=20=
triangle=20inequality.=20=20*/)=0A=20=20=20(Lisp_Object=20color1,=20=
Lisp_Object=20color2,=20Lisp_Object=20frame,=0A=20=20=20=20Lisp_Object=20=
metric)=0A=20{=0A@@=20-4931,7=20+4933,7=20@@=20DEFUN=20=
("face-attributes-as-vector",=20Fface_attributes_as_vector,=0A=20=0A=20=
/*=20If=20the=20distance=20(as=20returned=20by=20color_distance)=20=
between=20two=20colors=20is=0A=20=20=20=20less=20than=20this,=20then=20=
they=20are=20considered=20the=20same,=20for=20determining=0A-=20=20=20=
whether=20a=20color=20is=20supported=20or=20not.=20=20The=20range=20of=20=
values=20is=200-65535.=20=20*/=0A+=20=20=20whether=20a=20color=20is=20=
supported=20or=20not.=20=20*/=0A=20=0A=20#define=20=
TTY_SAME_COLOR_THRESHOLD=20=2010000=0A=20=0Adiff=20--git=20=
a/test/src/xfaces-tests.el=20b/test/src/xfaces-tests.el=0Anew=20file=20=
mode=20100644=0Aindex=200000000000..f08a87a518=0A---=20/dev/null=0A+++=20=
b/test/src/xfaces-tests.el=0A@@=20-0,0=20+1,27=20@@=0A+;;;=20=
xfaces-tests.el=20---=20tests=20for=20xfaces.c=20=20=20=20=20=20=20=20=20=
=20=20-*-=20lexical-binding:=20t=20-*-=0A+=0A+;;=20Copyright=20(C)=20=
2020=20Free=20Software=20Foundation,=20Inc.=0A+=0A+;;=20This=20file=20is=20=
part=20of=20GNU=20Emacs.=0A+=0A+;;=20GNU=20Emacs=20is=20free=20software:=20=
you=20can=20redistribute=20it=20and/or=20modify=0A+;;=20it=20under=20the=20=
terms=20of=20the=20GNU=20General=20Public=20License=20as=20published=20=
by=0A+;;=20the=20Free=20Software=20Foundation,=20either=20version=203=20=
of=20the=20License,=20or=0A+;;=20(at=20your=20option)=20any=20later=20=
version.=0A+=0A+;;=20GNU=20Emacs=20is=20distributed=20in=20the=20hope=20=
that=20it=20will=20be=20useful,=0A+;;=20but=20WITHOUT=20ANY=20WARRANTY;=20=
without=20even=20the=20implied=20warranty=20of=0A+;;=20MERCHANTABILITY=20=
or=20FITNESS=20FOR=20A=20PARTICULAR=20PURPOSE.=20=20See=20the=0A+;;=20=
GNU=20General=20Public=20License=20for=20more=20details.=0A+=0A+;;=20You=20=
should=20have=20received=20a=20copy=20of=20the=20GNU=20General=20Public=20=
License=0A+;;=20along=20with=20GNU=20Emacs.=20=20If=20not,=20see=20=
<https://www.gnu.org/licenses/>.=0A+=0A+(require=20'ert)=0A+=0A=
+(ert-deftest=20xfaces-color-distance=20()=0A+=20=20;;=20Check=20=
symmetry=20(bug#51455).=0A+=20=20(should=20(equal=20(color-distance=20=
"#222222"=20"#ffffff")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20(color-distance=20"#ffffff"=20"#222222"))))=0A+=0A+(provide=20=
'xfaces-tests)=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A=0A=

--Apple-Mail=_9A3622FA-6DF5-4FB7-9BFE-40A69D391DCB--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 2 Jun 2020 16:15:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 02 12:15:04 2020
Received: from localhost ([127.0.0.1]:40728 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jg9Z9-0001Ch-Pz
	for submit <at> debbugs.gnu.org; Tue, 02 Jun 2020 12:15:04 -0400
Received: from eggs.gnu.org ([209.51.188.92]:53902)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jg9Z8-0001Bu-4t
 for 41544 <at> debbugs.gnu.org; Tue, 02 Jun 2020 12:15:02 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:47539)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jg9Z2-0005Z8-A0; Tue, 02 Jun 2020 12:14:56 -0400
Received: from [176.228.60.248] (port=4300 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jg9Ys-0006Sn-UG; Tue, 02 Jun 2020 12:14:55 -0400
Date: Tue, 02 Jun 2020 19:14:28 +0300
Message-Id: <83y2p5cumz.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Tue, 2 Jun 2020 17:27:46 +0200)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN> <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.1 (---)

> From: Mattias EngdegÄrd <mattiase@HIDDEN>
> Date: Tue, 2 Jun 2020 17:27:46 +0200
> Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
> 
> Let's start with the color-distance changes, out of respect for the bug reporter if nothing else.
> 
> It is not possible to change a function without changing it. Either we fix it or we don't. The reported bug was about broken symmetry, which is rather embarrassing; as written previously, the first analysis uncovered deeper issues worth fixing, such as loss of precision and (especially) the nonlinearity that causes triangle inequality violation.
> 
> The proposed fixes to color-distance, I hope you agree, are straightforward, reasonable and address all these points. Callers have been updated with carefully recomputed comparison constants; I detailed how they were obtained in a previous reply, and test have all been satisfactory.

I'd prefer to fix only the symmetry bug (which AFAIU happens because
we use bit shifts on signed integers), without introducing any other
effects on the function's behavior and return values.  AFAIU, such a
fix should not require any changes outside of the function itself.

OK?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 2 Jun 2020 15:27:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 02 11:27:55 2020
Received: from localhost ([127.0.0.1]:40618 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jg8pW-0008Ms-TT
	for submit <at> debbugs.gnu.org; Tue, 02 Jun 2020 11:27:55 -0400
Received: from mail171c50.megamailservers.eu ([91.136.10.181]:54736
 helo=mail92c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jg8pU-0008Me-57
 for 41544 <at> debbugs.gnu.org; Tue, 02 Jun 2020 11:27:54 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591111670;
 bh=EiRxBbGhp6jfAwN+XKHGCHyTCvyBKXYNBE+Pu6v3iZ0=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=UcSvF0UUWQSxPwrqTwzs/BoIGlAD8nblBpPKhR9z5MuFm88I9BceOjdU8J9jdRCMq
 aotBJrMNAsSJVWdLS7yWm+uDfpXbra0BiXFQe/ilcUbSkYOxH0q1hJ6ZitjXfkYNy4
 cJyRz6Z18FeZ8kj50/9/Fgd8D9U6JnlpU/dbLUHQ=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail92c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 052FRlL5027557; 
 Tue, 2 Jun 2020 15:27:48 +0000
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <83mu5mel4o.fsf@HIDDEN>
Date: Tue, 2 Jun 2020 17:27:46 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <77F1DDD3-A69F-40ED-902D-74986D5E6596@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
 <83mu5mel4o.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F27.5ED66F9C.006E:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=aY8fYigt c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10
 a=mDV3o1hIAAAA:8 a=cU5vsblOPORyMJlAhFAA:9 a=CjuIK1q_8ugA:10
 a=_FVE-zBwftR9WsbkzFJk:22
X-Spam-Score: 1.4 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  1 juni 2020 kl. 19.44 skrev Eli Zaretskii <eliz@HIDDEN>:
 >> I'm just looking at the changes. I see a change in how colors are >>
 converted
 to RGB triplets. I see a change in what colors are >> considered dark and
 light, with a new function which decides tha [...] 
 Content analysis details:   (1.4 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: gnu.org]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.4 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

1 juni 2020 kl. 19.44 skrev Eli Zaretskii <eliz@HIDDEN>:

>> I'm just looking at the changes.  I see a change in how colors are
>> converted to RGB triplets.  I see a change in what colors are
>> considered dark and light, with a new function which decides that =
that
>> is being used for frame background mode and in several lisp/term/
>> files, including 16-color terminals.  I'm asking why do we want to
>> make all those changes, which modify very basic aspects of our color
>> support on many terminals.
>=20
> And then, of course, there are the changes in color-distance itself,
> which change the values it returns.  Again, why such significant
> changes to fix an otherwise insignificant bug?

It is difficult to give precise answers to vague complaints. Take one =
thing at a time: as I wrote, there are two different patches addressing =
two almost completely different issues. Let's start with the =
color-distance changes, out of respect for the bug reporter if nothing =
else.

It is not possible to change a function without changing it. Either we =
fix it or we don't. The reported bug was about broken symmetry, which is =
rather embarrassing; as written previously, the first analysis uncovered =
deeper issues worth fixing, such as loss of precision and (especially) =
the nonlinearity that causes triangle inequality violation.

The proposed fixes to color-distance, I hope you agree, are =
straightforward, reasonable and address all these points. Callers have =
been updated with carefully recomputed comparison constants; I detailed =
how they were obtained in a previous reply, and test have all been =
satisfactory.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 2 Jun 2020 15:08:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 02 11:08:56 2020
Received: from localhost ([127.0.0.1]:40608 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jg8XA-0007rr-AE
	for submit <at> debbugs.gnu.org; Tue, 02 Jun 2020 11:08:56 -0400
Received: from mail72c50.megamailservers.eu ([91.136.10.82]:52188
 helo=mail92c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jg8X8-0007rg-19
 for 41544 <at> debbugs.gnu.org; Tue, 02 Jun 2020 11:08:55 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591110531;
 bh=MIA2Ed32TuY1chjkz5llieGREe7djImuoIaKeSndBY8=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=OVRdgBLo1DeY6FOUhyRb0qW3Jd4cXOkp17P6Uu6qzA2dAVDyNr5eZwDVpZI4IqMm8
 ZnG8GTruTwudwhWs8GnEQoh33xT52t2ln83bFhlai3d8cxXGSZGNOu1Tu7t4JRfwpr
 M9rg2Te97gDpFNQJU0NWrvgLOAYq5stK8sQdaseY=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail92c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 052F8lDD031069; 
 Tue, 2 Jun 2020 15:08:49 +0000
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <877dwqbmc6.fsf@HIDDEN>
Date: Tue, 2 Jun 2020 17:08:47 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <E801A168-E8AD-4A1F-84FF-3BBA6D34BD03@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <877dwqbmc6.fsf@HIDDEN>
To: "Basil L. Contovounesios" <contovob@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F28.5ED66B31.0058:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=aY8fYigt c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10
 a=ki0sEvHv-SN8jT7Vzy0A:9 a=CjuIK1q_8ugA:10
X-Spam-Score: 1.4 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: 1 juni 2020 kl. 21.46 skrev Basil L. Contovounesios
 <contovob@HIDDEN>:
 > Does the list of 7 places already include net/shr-color.el? No, and thanks
 for bringing it to my attention! That code appears considerably more
 sophisticated
 than the others, and its task (in shr-color-visible) is somewhat different
 (not just a decision betwee [...] 
 Content analysis details:   (1.4 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: megamailservers.eu]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.4 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 41544
Cc: Tom Tromey <tom@HIDDEN>, Simon Pugnet <simon@HIDDEN>,
 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

1 juni 2020 kl. 21.46 skrev Basil L. Contovounesios <contovob@HIDDEN>:

> Does the list of 7 places already include net/shr-color.el?

No, and thanks for bringing it to my attention! That code appears =
considerably more sophisticated than the others, and its task (in =
shr-color-visible) is somewhat different (not just a decision between =
black and white as contrasting colour). It's probably better to leave it =
alone for now.






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 1 Jun 2020 19:46:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 01 15:46:58 2020
Received: from localhost ([127.0.0.1]:37053 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jfqOg-0005y0-AX
	for submit <at> debbugs.gnu.org; Mon, 01 Jun 2020 15:46:58 -0400
Received: from mail-wr1-f44.google.com ([209.85.221.44]:37482)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <contovob@HIDDEN>) id 1jfqOf-0005xo-9C
 for 41544 <at> debbugs.gnu.org; Mon, 01 Jun 2020 15:46:57 -0400
Received: by mail-wr1-f44.google.com with SMTP id x13so1042616wrv.4
 for <41544 <at> debbugs.gnu.org>; Mon, 01 Jun 2020 12:46:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=tcd-ie.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=feDuKHc53Hvro98HSL1jGCp4YbpNH135AqOpRbWBN7Q=;
 b=yDYoeTqxS2aT8c9sOMRaUOa5wJRCrZw0hMyUEriYjjKJBjsMuWRVvyQbMzG7cKtyk2
 wAQ81D5epWKyDLrmBAvjYQ0A6xvTmZVA/mn6c3fI03ENzlWkMo0GrjHbyY0S3EiN3uO3
 QkM4jPcis/qBZNhRTOuWlM5bfToU3G0EzKy4TNGrJWc+/FekKS061Uo7qKJRaWmCbM9j
 mf2O+Qeu+wN+qZ3IlFeZylDWHBlMwouIZwQ2CZ/yfOWGsF/l2YeYKltJNLa3FdzMGINO
 xm3zOCAcllBCzX3tKMAhxLm1GU1oTii3naHZiIAmJwJ73SPbcnOb+Zip5ClCMmVA9cUg
 wSuw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=feDuKHc53Hvro98HSL1jGCp4YbpNH135AqOpRbWBN7Q=;
 b=YyS9tj7HLKrCT6T+sJZgN5XUnmqYUGF6hArUzzosF4NrBwsHdFXG959BnfbodyaJ3P
 snDUSEgcpnCFbXxfYrgT2CkdTRgefJGRHFwOjQ7rBTIRIWkvUyC5FtJMfMpK6KTu9w7R
 j2GpL0PRmBhdjiT6O1+NZ3vQAH64OfUp0ZEPi/+J3pgl5+Plt9BkHPvh9Pa3gGfJH8SW
 t4RH+icowVDqXyX6ampqXBt55J7CU9ztLp/odQJqd6w5N6qiragkV+sKLC/i69EsLaVU
 RHZvGgqiUQsZU0jlfXHivU48UtZBrLYxIs6VWAmq6/KuZpTrLWkU+uRrW8Gf+U6Mvi1V
 tXKw==
X-Gm-Message-State: AOAM530R2Of2haQX7nlmtJYV+3bsf70YMNck6mBjmvFHVIQwfuyHDpfA
 mLbj7tuCD46b0LdxhkQaV5zmYQ==
X-Google-Smtp-Source: ABdhPJzgAJr0SR1VA6ZQiJ7FQJfzUqMBnvnUHMehOCkw+7An0qkSYH35ranW9Zpgf2zhh6tFkUmadA==
X-Received: by 2002:a05:6000:1003:: with SMTP id
 a3mr8576969wrx.111.1591040811211; 
 Mon, 01 Jun 2020 12:46:51 -0700 (PDT)
Received: from localhost ([2a02:8084:20e2:c380:1f68:7ff5:120d:64e])
 by smtp.gmail.com with ESMTPSA id 138sm511500wma.23.2020.06.01.12.46.50
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 01 Jun 2020 12:46:50 -0700 (PDT)
From: "Basil L. Contovounesios" <contovob@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN>
 <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN>
Date: Mon, 01 Jun 2020 20:46:49 +0100
In-Reply-To: <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> ("Mattias
 =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Sun, 31 May 2020 22:46:07
 +0200")
Message-ID: <877dwqbmc6.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 41544
Cc: Tom Tromey <tom@HIDDEN>, Simon Pugnet <simon@HIDDEN>,
 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Mattias Engdeg=C3=A5rd <mattiase@HIDDEN> writes:

> Emacs does this sort of is-this-colour-dark computation in at least 7
> different places, with different algorithms:
>
> * max(r,g,b) < 0.5
> * r+g+b < 0.5*3
> * color-distance(c, "black") < 292485

Does the list of 7 places already include net/shr-color.el?

--=20
Basil




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 1 Jun 2020 17:44:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 01 13:44:54 2020
Received: from localhost ([127.0.0.1]:36947 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jfoUY-0002yA-7q
	for submit <at> debbugs.gnu.org; Mon, 01 Jun 2020 13:44:54 -0400
Received: from eggs.gnu.org ([209.51.188.92]:55000)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jfoUW-0002xx-8R
 for 41544 <at> debbugs.gnu.org; Mon, 01 Jun 2020 13:44:53 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:53202)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jfoUP-0004Gf-Sw; Mon, 01 Jun 2020 13:44:45 -0400
Received: from [176.228.60.248] (port=1400 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jfoUO-0005NT-ND; Mon, 01 Jun 2020 13:44:45 -0400
Date: Mon, 01 Jun 2020 20:44:39 +0300
Message-Id: <83mu5mel4o.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: mattiase@HIDDEN
In-Reply-To: <83o8q2elja.fsf@HIDDEN> (message from Eli Zaretskii on Mon, 01
 Jun 2020 20:35:53 +0300)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> <83o8q2elja.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Mon, 01 Jun 2020 20:35:53 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
> 
> I'm just looking at the changes.  I see a change in how colors are
> converted to RGB triplets.  I see a change in what colors are
> considered dark and light, with a new function which decides that that
> is being used for frame background mode and in several lisp/term/
> files, including 16-color terminals.  I'm asking why do we want to
> make all those changes, which modify very basic aspects of our color
> support on many terminals.

And then, of course, there are the changes in color-distance itself,
which change the values it returns.  Again, why such significant
changes to fix an otherwise insignificant bug?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 1 Jun 2020 17:36:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 01 13:36:09 2020
Received: from localhost ([127.0.0.1]:36943 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jfoM5-0002lk-A1
	for submit <at> debbugs.gnu.org; Mon, 01 Jun 2020 13:36:09 -0400
Received: from eggs.gnu.org ([209.51.188.92]:53562)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jfoM1-0002lC-Dy
 for 41544 <at> debbugs.gnu.org; Mon, 01 Jun 2020 13:36:07 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:53071)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jfoLv-0002IP-4A; Mon, 01 Jun 2020 13:35:59 -0400
Received: from [176.228.60.248] (port=4829 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jfoLu-0004lN-5S; Mon, 01 Jun 2020 13:35:58 -0400
Date: Mon, 01 Jun 2020 20:35:53 +0300
Message-Id: <83o8q2elja.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Mon, 1 Jun 2020 19:24:45 +0200)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
 <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Mattias EngdegÄrd <mattiase@HIDDEN>
> Date: Mon, 1 Jun 2020 19:24:45 +0200
> Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
> 
> > I'm worried because the way our automatic color mapping on
> > color-challenged TTYs works took some time to get right, and it worked
> > well for years.  If we want to risk rocking that particular boat som
> > profoundly, we had better had a very good reason, preferably several
> > good reasons.
> 
> Not quite sure what you are talking about here. You previously asked about the exact value of TTY_SAME_COLOR_THRESHOLD. Were you unsatisfied with my answer, and if so, in what respect?

I'm just looking at the changes.  I see a change in how colors are
converted to RGB triplets.  I see a change in what colors are
considered dark and light, with a new function which decides that that
is being used for frame background mode and in several lisp/term/
files, including 16-color terminals.  I'm asking why do we want to
make all those changes, which modify very basic aspects of our color
support on many terminals.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 1 Jun 2020 17:25:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 01 13:25:02 2020
Received: from localhost ([127.0.0.1]:36926 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jfoBH-0002Tf-0g
	for submit <at> debbugs.gnu.org; Mon, 01 Jun 2020 13:25:02 -0400
Received: from mail1450c50.megamailservers.eu ([91.136.14.50]:47058
 helo=mail265c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jfoBE-0002TR-Cc
 for 41544 <at> debbugs.gnu.org; Mon, 01 Jun 2020 13:24:57 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1591032289;
 bh=wCRDcnNqgat74Gf4ebJyCwelsaWYz0d9DTHDtfdIcPE=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=A1UvYsdVGy/iDEMACVMe8cmPMsF2vvoqY0kfbLUDdghMmlXVPsyq/oIcUdk/oiT5z
 jH1xn2tcL1rzb0vKsHntfE1PNwu10pRHagUCd7FrXhfM+Pz8x9imvLVBcfl3jFsvNH
 VQFe0YkaAfMhiZjec5DxmzDrMtAH912lC3l33oyQ=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail265c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 051HOkwQ002093; 
 Mon, 1 Jun 2020 17:24:47 +0000
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <83tuzueogo.fsf@HIDDEN>
Date: Mon, 1 Jun 2020 19:24:45 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <6272275C-560C-4437-90F1-2A8294D27019@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> <83tuzueogo.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F26.5ED53987.006A:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=D5w51cZj c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10
 a=mDV3o1hIAAAA:8 a=HwH1CxdJoGffx6xDYTMA:9 a=CjuIK1q_8ugA:10
 a=_FVE-zBwftR9WsbkzFJk:22
X-Spam-Score: 1.4 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  1 juni 2020 kl. 18.32 skrev Eli Zaretskii <eliz@HIDDEN>:
 > Please remind me why do we want to make such deep and wide changes in >
 our color system? Is that just because we have a minor bug in >
 color-distance?
 Wouldn't it be better to just fix that one bug [...] 
 Content analysis details:   (1.4 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: gnu.org]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.4 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

1 juni 2020 kl. 18.32 skrev Eli Zaretskii <eliz@HIDDEN>:

> Please remind me why do we want to make such deep and wide changes in
> our color system?  Is that just because we have a minor bug in
> color-distance?  Wouldn't it be better to just fix that one bug?

These changes are neither deep nor wide. Perhaps the confusion arose =
from remeding two almost entirely independent issues in the same =
discussion: the flaws in color-distance, taken care of by the first =
patch, and the contrasting colour computation, which was the topic of =
the message and patch you replied to.

Sorry about conflating the two -- I should have opened a separate bug =
for the colour contrast mess. Their only point of intersection was, in =
hindsight, rather coincidental (css-mode).

> I'm worried because the way our automatic color mapping on
> color-challenged TTYs works took some time to get right, and it worked
> well for years.  If we want to risk rocking that particular boat som
> profoundly, we had better had a very good reason, preferably several
> good reasons.

Not quite sure what you are talking about here. You previously asked =
about the exact value of TTY_SAME_COLOR_THRESHOLD. Were you unsatisfied =
with my answer, and if so, in what respect?





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 1 Jun 2020 16:32:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 01 12:32:48 2020
Received: from localhost ([127.0.0.1]:36848 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jfnMl-00017L-S4
	for submit <at> debbugs.gnu.org; Mon, 01 Jun 2020 12:32:48 -0400
Received: from eggs.gnu.org ([209.51.188.92]:45480)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jfnMk-000178-Dy
 for 41544 <at> debbugs.gnu.org; Mon, 01 Jun 2020 12:32:46 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:52109)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jfnMd-0006C0-Ri; Mon, 01 Jun 2020 12:32:40 -0400
Received: from [176.228.60.248] (port=4654 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jfnMc-00066W-Qn; Mon, 01 Jun 2020 12:32:39 -0400
Date: Mon, 01 Jun 2020 19:32:39 +0300
Message-Id: <83tuzueogo.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Sun, 31 May 2020 22:46:07 +0200)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
 <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Mattias EngdegÄrd <mattiase@HIDDEN>
> Date: Sun, 31 May 2020 22:46:07 +0200
> Cc: Simon Pugnet <simon@HIDDEN>, 41544 <at> debbugs.gnu.org,
>         Eli Zaretskii <eliz@HIDDEN>
> 
> Proposed patch attached. I found css-mode no worse than before (a tad better, if anything). Perhaps we need to decompress to linear components after all, but at least now there is a single place to do it.
> 
> (Should list-colors-display use color-dark-p for the text in its left column, by the way? Or is there a point in not doing so?)

Please remind me why do we want to make such deep and wide changes in
our color system?  Is that just because we have a minor bug in
color-distance?  Wouldn't it be better to just fix that one bug?

I'm worried because the way our automatic color mapping on
color-challenged TTYs works took some time to get right, and it worked
well for years.  If we want to risk rocking that particular boat som
profoundly, we had better had a very good reason, preferably several
good reasons.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 31 May 2020 20:46:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 31 16:46:16 2020
Received: from localhost ([127.0.0.1]:33954 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jfUqW-0007O4-4S
	for submit <at> debbugs.gnu.org; Sun, 31 May 2020 16:46:16 -0400
Received: from mail208c50.megamailservers.eu ([91.136.10.218]:53996
 helo=mail194c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jfUqT-0007Nu-7y
 for 41544 <at> debbugs.gnu.org; Sun, 31 May 2020 16:46:14 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1590957970;
 bh=ooMLS9DDFzKSGSxXjp/3+EGdBk0U2wGJBMbfN6qNNf4=;
 h=From:Subject:Date:In-Reply-To:Cc:To:References:From;
 b=B6Jpy68SQ0/A2qu5YuKnv9cfKYOVqmXrHaeexbMwRBuycmNPfjobDFwdrWoo3S5et
 g+3WOZt165TbM3XdcOAmM/zCMy44t2mV91V0cRALVHj58l7OqraQTnK6ryzcacWZS4
 fDa69uucErSHwjjrepvON9EOl2FQznlvLEwMhQbE=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail194c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 04VKk7hn017708; 
 Sun, 31 May 2020 20:46:09 +0000
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Message-Id: <9902865C-01B4-4E50-A433-DBC8B8311234@HIDDEN>
Content-Type: multipart/mixed;
 boundary="Apple-Mail=_7FF6E8CE-41E3-44BB-A837-E0A212C5FA1B"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
Date: Sun, 31 May 2020 22:46:07 +0200
In-Reply-To: <87r1v2aat3.fsf@HIDDEN>
To: Tom Tromey <tom@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <87r1v2aat3.fsf@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F1C.5ED41749.000C:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=KsozJleN c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=M51BFTxLslgA:10 a=zstS-IiYAAAA:8
 a=yhKnspnhLiaNJBSypWMA:9 a=CjuIK1q_8ugA:10 a=LUiTdrM7ar1z_bhPKtoA:9
 a=B2y7HmGcmWMA:10 a=tclcd6dtLQvEqt9_mmAA:9 a=4G6NA9xxw8l3yy4pmD5M:22
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 41544
Cc: Eli Zaretskii <eliz@HIDDEN>, Simon Pugnet <simon@HIDDEN>,
 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)


--Apple-Mail=_7FF6E8CE-41E3-44BB-A837-E0A212C5FA1B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

29 maj 2020 kl. 19.52 skrev Tom Tromey <tom@HIDDEN>:

> However, my main concern is just whether it still picks reasonably
> contrasting colors when editing CSS.  If it does, then that's good
> enough for me.

Thank you for the kind words. I couldn't leave well enough alone, of =
course. Emacs does this sort of is-this-colour-dark computation in at =
least 7 different places, with different algorithms:

* max(r,g,b) < 0.5
* r+g+b < 0.5*3
* color-distance(c, "black") < 292485

They aren't really satisfactory: for example, saturated blue (#0000ff) =
is quite clearly 'dark', yet the first algorithm considers it 'light'. =
Colour distance isn't quite right either -- the implemented formula is =
intended to measure distances between colours, not brightness. For =
example, it considers #ff0000 to be closer than #0000ff to black, but =
the red is clearly brighter.

I tentatively went with your suggested 0.299r + 0.587g + 0.114g, with a =
cut-off value of 0.58 to make saturated blue and red 'dark' and green =
'light'. This is not a correct luma calculation since there is no gamma =
correction, but it might do for this purpose.

Proposed patch attached. I found css-mode no worse than before (a tad =
better, if anything). Perhaps we need to decompress to linear components =
after all, but at least now there is a single place to do it.

(Should list-colors-display use color-dark-p for the text in its left =
column, by the way? Or is there a point in not doing so?)


--Apple-Mail=_7FF6E8CE-41E3-44BB-A837-E0A212C5FA1B
Content-Disposition: attachment;
	filename=0001-Use-a-single-light-dark-colour-predicate.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="0001-Use-a-single-light-dark-colour-predicate.patch"
Content-Transfer-Encoding: quoted-printable

=46rom=205d5ef884c47695a39c22d931c4bc44e6a812d7b4=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20=
<mattiase@HIDDEN>=0ADate:=20Sun,=2031=20May=202020=2021:12:46=20+0200=0A=
Subject:=20[PATCH]=20Use=20a=20single=20light/dark=20colour=20predicate=0A=
=0AAdd=20a=20single=20predicate,=20color-dark-p,=20for=20deciding=20=
whether=20a=20colour=0Ais=20more=20readable=20against=20black=20or=20=
white.=20=20Previously=20this=20was=20done=20in=0Adifferent=20ways=20in=20=
several=20places,=20and=20with=20worse=20results.=20=20(Bug#41544)=0A=0A=
*=20lisp/color.el=20(color-name-to-rgb):=20Use=20color-component-max=20=
instead=0Aof=20the=20error-prone=20method=20of=20(color-values=20=
"#ffffffffffff"),=20which=0Awould=20give=20unexpected=20values=20or=20=
outright=20fail=20if=20called=20without=0Aan=20initialised=20display=20=
(as=20in=20batch=20mode).=0A*=20lisp/facemenu.el=20(list-colors-print):=20=
Use=20readable-foreground-color.=0A(color-dark-p,=20=
color-component-max):=20New=20functions.=0A*=20lisp/term/pc-win.el:=20=
Update=20comment.=0A*=20lisp/term/rxvt.el=20(rxvt-set-background-mode):=0A=
*=20lisp/term/w32console.el=20(terminal-init-w32console):=0A*=20=
lisp/term/xterm.el=20(xterm-maybe-set-dark-background-mode):=0A*=20=
lisp/faces.el=20(readable-foreground-color):=0A*=20lisp/frame.el=20=
(frame-set-background-mode):=20Use=20color-dark-p.=0A*=20=
lisp/textmodes/css-mode.el=20(css--contrasty-color):=20Remove.=0A=
(css--fontify-region):=20Use=20color-dark-p.=0A---=0A=20lisp/color.el=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20|=20=204=20+---=0A=20=
lisp/facemenu.el=20=20=20=20=20=20=20=20=20=20=20|=20=208=20+++-----=0A=20=
lisp/faces.el=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=2034=20=
+++++++++++++++++++++++++---------=0A=20lisp/frame.el=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20|=2010=20+++-------=0A=20lisp/term/pc-win.el=20=20=20=
=20=20=20=20=20|=20=208=20+++-----=0A=20lisp/term/rxvt.el=20=20=20=20=20=20=
=20=20=20=20|=2012=20+++++-------=0A=20lisp/term/w32console.el=20=20=20=20=
|=20=205=20++---=0A=20lisp/term/xterm.el=20=20=20=20=20=20=20=20=20|=20=20=
5=20++---=0A=20lisp/textmodes/css-mode.el=20|=2014=20++------------=0A=20=
9=20files=20changed,=2046=20insertions(+),=2054=20deletions(-)=0A=0Adiff=20=
--git=20a/lisp/color.el=20b/lisp/color.el=0Aindex=20=
560631ae66..2385874028=20100644=0A---=20a/lisp/color.el=0A+++=20=
b/lisp/color.el=0A@@=20-50,9=20+50,7=20@@=20color-name-to-rgb=0A=20=
Optional=20argument=20FRAME=20specifies=20the=20frame=20where=20the=20=
color=20is=20to=20be=0A=20displayed.=20=20If=20FRAME=20is=20omitted=20or=20=
nil,=20use=20the=20selected=20frame.=0A=20If=20FRAME=20cannot=20display=20=
COLOR,=20return=20nil."=0A-=20=20;;=20`colors-values'=20maximum=20value=20=
is=20either=2065535=20or=2065280=20depending=20on=20the=0A-=20=20;;=20=
display=20system.=20=20So=20we=20use=20a=20white=20conversion=20to=20get=20=
the=20max=20value.=0A-=20=20(let=20((valmax=20(float=20(car=20=
(color-values=20"#ffffffffffff")))))=0A+=20=20(let=20((valmax=20(float=20=
(color-component-max=20frame))))=0A=20=20=20=20=20(mapcar=20(lambda=20=
(x)=20(/=20x=20valmax))=20(color-values=20color=20frame))))=0A=20=0A=20=
(defun=20color-rgb-to-hex=20=20(red=20green=20blue=20&optional=20=
digits-per-component)=0Adiff=20--git=20a/lisp/facemenu.el=20=
b/lisp/facemenu.el=0Aindex=20b10d874b21..119a2ba790=20100644=0A---=20=
a/lisp/facemenu.el=0A+++=20b/lisp/facemenu.el=0A@@=20-621,9=20+621,7=20=
@@=20list-colors-print=0A=20=09=09=09=09=09=09=20(downcase=20b))))))=0A=20=
=09(setq=20color=20(list=20color)))=0A=20=20=20=20=20=20=20(let*=20=
((opoint=20(point))=0A-=09=20=20=20=20=20(color-values=20(color-values=20=
(car=20color)))=0A-=09=20=20=20=20=20(light-p=20(>=3D=20(apply=20'max=20=
color-values)=0A-=09=09=09=20=20(*=20(car=20(color-values=20"white"))=20=
.5))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20(fg=20=
(readable-foreground-color=20(car=20color))))=0A=20=09(insert=20(car=20=
color))=0A=20=09(indent-to=2022)=0A=20=09(put-text-property=20opoint=20=
(point)=20'face=20`(:background=20,(car=20color)))=0A@@=20-639,7=20=
+637,7=20@@=20list-colors-print=0A=20=09(insert=20(propertize=0A=20=09=09=
=20(apply=20'format=20"#%02x%02x%02x"=0A=20=09=09=09(mapcar=20(lambda=20=
(c)=20(ash=20c=20-8))=0A-=09=09=09=09color-values))=0A+=09=09=09=09=
(color-values=20(car=20color))))=0A=20=09=09=20'mouse-face=20'highlight=0A=
=20=09=09=20'help-echo=0A=20=09=09=20(let=20((hsv=20(apply=20=
'color-rgb-to-hsv=0A@@=20-651,7=20+649,7=20@@=20list-colors-print=0A=20=09=
=20=20=20opoint=20(point)=0A=20=09=20=20=20'follow-link=20t=0A=20=09=20=20=
=20'mouse-face=20(list=20:background=20(car=20color)=0A-=09=09=09=20=20=20=
=20=20:foreground=20(if=20light-p=20"black"=20"white"))=0A+=09=09=09=20=20=
=20=20=20:foreground=20fg)=0A=20=09=20=20=20'color-name=20(car=20color)=0A=
=20=09=20=20=20'action=20callback-fn)))=0A=20=20=20=20=20=20=20(insert=20=
"\n"))=0Adiff=20--git=20a/lisp/faces.el=20b/lisp/faces.el=0Aindex=20=
e707f6f4b6..2b9bcb9bcf=20100644=0A---=20a/lisp/faces.el=0A+++=20=
b/lisp/faces.el=0A@@=20-1786,15=20+1786,22=20@@=20=
defined-colors-with-face-attributes=0A=20=0A=20(defun=20=
readable-foreground-color=20(color)=0A=20=20=20"Return=20a=20readable=20=
foreground=20color=20for=20background=20COLOR."=0A-=20=20(let*=20((rgb=20=
=20=20(color-values=20color))=0A-=09=20(max=20=20=20(apply=20#'max=20=
rgb))=0A-=09=20(black=20(car=20(color-values=20"black")))=0A-=09=20=
(white=20(car=20(color-values=20"white"))))=0A-=20=20=20=20;;=20Select=20=
black=20or=20white=20depending=20on=20which=20one=20is=20less=20similar=20=
to=0A-=20=20=20=20;;=20the=20brightest=20component.=0A-=20=20=20=20(if=20=
(>=20(abs=20(-=20max=20black))=20(abs=20(-=20max=20white)))=0A-=09=
"black"=0A-=20=20=20=20=20=20"white")))=0A+=20=20(if=20(color-dark-p=20=
(color-name-to-rgb=20color))=20"white"=20"black"))=0A+=0A+(defun=20=
color-dark-p=20(rgb)=0A+=20=20"Whether=20RGB=20is=20more=20readable=20=
against=20white=20than=20black.=0A+RGB=20is=20a=203-element=20list=20(R=20=
G=20B),=20each=20component=20in=20the=20range=20[0,1]."=0A+=20=20(let=20=
((r=20(nth=200=20rgb))=0A+=20=20=20=20=20=20=20=20(g=20(nth=201=20rgb))=0A=
+=20=20=20=20=20=20=20=20(b=20(nth=202=20rgb)))=0A+=20=20=20=20(unless=20=
(<=3D=200=20(min=20r=20g=20b)=20(max=20r=20g=20b)=201)=0A+=20=20=20=20=20=
=20(error=20"RGB=20component=20not=20in=20[0,1]"))=0A+=20=20=20=20;;=20=
Simple=20heuristic=20--=20correct=20luma=20requires=20gamma=20=
correction,=0A+=20=20=20=20;;=20which=20is=20overkill=20for=20this=20=
purpose.=0A+=20=20=20=20;;=20The=20cut-off=20value=20was=20designed=20to=20=
make=20saturated=20green=20'light',=0A+=20=20=20=20;;=20but=20saturated=20=
red=20and=20blue=20'dark'.=0A+=20=20=20=20(<=20(+=20(*=20r=200.299)=20(*=20=
g=200.587)=20(*=20b=200.114))=0A+=20=20=20=20=20=20=200.58)))=0A=20=0A=20=
(declare-function=20xw-color-defined-p=20"xfns.c"=20(color=20&optional=20=
frame))=0A=20=0A@@=20-1840,6=20+1847,15=20@@=20color-values=0A=20=20=20=20=
(t=0A=20=20=20=20=20(tty-color-values=20color=20frame))))=0A=20=0A=
+(defun=20color-component-max=20(&optional=20frame)=0A+=20=20"The=20=
highest=20value=20of=20a=20color=20component=20on=20FRAME.=0A+If=20FRAME=20=
is=20omitted=20or=20nil,=20use=20the=20selected=20frame."=0A+=20=20;;=20=
Right=20now,=20NS=20frames=20are=20the=20only=20ones=20having=20a=20=
different=20maximum=0A+=20=20;;=20colour=20component=20value.=0A+=20=20=
(if=20(eq=20(framep-on-display=20frame)=20'ns)=0A+=20=20=20=20=20=20=
#xff00=0A+=20=20=20=20#xffff))=0A+=0A=20(defalias=20'x-color-values=20=
'color-values)=0A=20=0A=20(declare-function=20xw-display-color-p=20=
"xfns.c"=20(&optional=20terminal))=0Adiff=20--git=20a/lisp/frame.el=20=
b/lisp/frame.el=0Aindex=206c2f774709..fed46f333d=20100644=0A---=20=
a/lisp/frame.el=0A+++=20b/lisp/frame.el=0A@@=20-1181,13=20+1181,9=20@@=20=
frame-set-background-mode=0A=20=09=09=20=20=20non-default-bg-mode)=0A=20=09=
=09=20=20((not=20(color-values=20bg-color=20frame))=0A=20=09=09=20=20=20=
default-bg-mode)=0A-=09=09=20=20((>=3D=20(apply=20'+=20(color-values=20=
bg-color=20frame))=0A-=09=09=20=20=20=20=20=20=20;;=20Just=20looking=20=
at=20the=20screen,=20colors=20whose=0A-=09=09=20=20=20=20=20=20=20;;=20=
values=20add=20up=20to=20.6=20of=20the=20white=20total=0A-=09=09=20=20=20=
=20=20=20=20;;=20still=20look=20dark=20to=20me.=0A-=09=09=20=20=20=20=20=20=
=20(*=20(apply=20'+=20(color-values=20"white"=20frame))=20.6))=0A-=09=09=20=
=20=20'light)=0A-=09=09=20=20(t=20'dark)))=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20((color-dark-p=20(color-name-to-rgb=20=
bg-color=20frame))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20'dark)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(t=20=
'light)))=0A=20=09=20=20=20(display-type=0A=20=09=20=20=20=20(cond=20=
((null=20(window-system=20frame))=0A=20=09=09=20=20=20(if=20=
(tty-display-color-p=20frame)=20'color=20'mono))=0Adiff=20--git=20=
a/lisp/term/pc-win.el=20b/lisp/term/pc-win.el=0Aindex=20=
76a48a86c7..16eb660f00=20100644=0A---=20a/lisp/term/pc-win.el=0A+++=20=
b/lisp/term/pc-win.el=0A@@=20-54,11=20+54,9=20@@=0A=20;;=20=
DJGPP-compiled=20Emacs=20on=20the=20same=20PC.=20=20The=20names=20of=20X=20=
colors=20used=20to=0A=20;;=20define=20the=20pixel=20values=20are=20shown=20=
as=20comments=20to=20each=20color=20below.=0A=20;;;=0A-;;=20If=20you=20=
want=20to=20change=20the=20RGB=20values,=20keep=20in=20mind=20that=20=
various=20pieces=0A-;;=20of=20Emacs=20think=20that=20a=20color=20whose=20=
RGB=20values=20add=20up=20to=20less=20than=200.6=20of=0A-;;=20the=20=
values=20for=20WHITE=20(i.e.=20less=20than=20117963)=20are=20``dark'',=20=
otherwise=20the=0A-;;=20color=20is=20``light'';=20see=20=
`frame-set-background-mode'=20in=20lisp/faces.el=20for=0A-;;=20an=20=
example.=0A+;;=20If=20you=20want=20to=20change=20the=20RGB=20values,=20=
consider=20the=20heuristics=20in=0A+;;=20`color-dark-p'=20which=20is=20=
used=20to=20select=20a=20suitably=20contrasting=0A+;;=20foreground=20or=20=
background=20colour.=0A=20(defvar=20msdos-color-values=0A=20=20=20=
'(("black"=20=20=20=20=20=20=20=20=20=200=20=20=20=20=200=20=20=20=20=20=
0=20=20=20=20=200)=0A=20=20=20=20=20("blue"=20=20=20=20=20=20=20=20=20=20=
=201=20=20=20=20=200=20=20=20=20=200=2052480)=20;=20MediumBlue=0Adiff=20=
--git=20a/lisp/term/rxvt.el=20b/lisp/term/rxvt.el=0Aindex=20=
31e3d6ede4..ebcb13db77=20100644=0A---=20a/lisp/term/rxvt.el=0A+++=20=
b/lisp/term/rxvt.el=0A@@=20-206,13=20+206,11=20@@=20=
rxvt-set-background-mode=0A=20=20=20=20=20=20=20;;=20The=20next=20line=20=
assumes=20that=20rxvt-standard-colors=20are=20ordered=0A=20=20=20=20=20=20=
=20;;=20by=20the=20color=20index=20in=20the=20ascending=20order!=0A=20=20=
=20=20=20=20=20(setq=20rgb=20(car=20(cddr=20(nth=20bg=20=
rxvt-standard-colors))))=0A-=20=20=20=20=20=20;;=20See=20the=20=
commentary=20in=20frame-set-background-mode=20about=20the=0A-=20=20=20=20=
=20=20;;=20computation=20below.=0A-=20=20=20=20=20=20(if=20(<=20(apply=20=
'+=20rgb)=0A-=09=20=20=20=20=20;;=20The=20following=20line=20assumes=20=
that=20white=20is=20the=2015th=0A-=09=20=20=20=20=20;;=20color=20in=20=
rxvt-standard-colors.=0A-=09=20=20=20=20=20(*=20(apply=20'+=20(car=20=
(cddr=20(nth=2015=20rxvt-standard-colors))))=200.6))=0A-=09=20=20=
(set-terminal-parameter=20nil=20'background-mode=20'dark)))))=0A+=20=20=20=
=20=20=20;;=20The=20following=20line=20assumes=20that=20white=20is=20the=20=
15th=0A+=20=20=20=20=20=20;;=20color=20in=20rxvt-standard-colors.=0A+=20=20=
=20=20=20=20(let=20((comp-max=20(caddr=20(nth=2015=20=
rxvt-standard-colors))))=0A+=20=20=20=20=20=20=20=20(when=20=
(color-dark-p=20(mapcar=20(lambda=20(c)=20(/=20c=20comp-max))=20rgb))=0A=
+=09=20=20(set-terminal-parameter=20nil=20'background-mode=20'dark))))))=0A=
=20=0A=20(provide=20'term/rxvt)=0A=20=0Adiff=20--git=20=
a/lisp/term/w32console.el=20b/lisp/term/w32console.el=0Aindex=20=
36e9d896c7..b249a4e602=20100644=0A---=20a/lisp/term/w32console.el=0A+++=20=
b/lisp/term/w32console.el=0A@@=20-86,9=20+86,8=20@@=20=
terminal-init-w32console=0A=20=20=20=20=20(setq=20r=20(nth=202=20descr)=0A=
=20=09=20=20g=20(nth=203=20descr)=0A=20=09=20=20b=20(nth=204=20descr))=0A=
-=20=20=20=20(if=20(<=20(+=20r=20g=20b)=20(*=20.6=20(+=2065535=2065535=20=
65535)))=0A-=09(setq=20bg-mode=20'dark)=0A-=20=20=20=20=20=20(setq=20=
bg-mode=20'light))=0A+=20=20=20=20(setq=20bg-mode=20(if=20(color-dark-p=20=
(list=20(/=20r=2065535)=20(/=20g=2065535)=20(/=20b=2065535)))=0A+=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'dark=20=
'light))=0A=20=20=20=20=20(set-terminal-parameter=20nil=20=
'background-mode=20bg-mode))=0A=20=20=20(tty-set-up-initial-frame-faces)=0A=
=20=20=20(run-hooks=20'terminal-init-w32-hook))=0Adiff=20--git=20=
a/lisp/term/xterm.el=20b/lisp/term/xterm.el=0Aindex=20=
1a727e3933..bf9bcae526=20100644=0A---=20a/lisp/term/xterm.el=0A+++=20=
b/lisp/term/xterm.el=0A@@=20-1120,9=20+1120,8=20@@=20=
xterm-register-default-colors=0A=20=20=20=20=20(clear-face-cache)))=0A=20=
=0A=20(defun=20xterm-maybe-set-dark-background-mode=20(redc=20greenc=20=
bluec)=0A-=20=20;;=20Use=20the=20heuristic=20in=20=
`frame-set-background-mode'=20to=20decide=20if=20a=0A-=20=20;;=20frame=20=
is=20dark.=0A-=20=20(when=20(<=20(+=20redc=20greenc=20bluec)=20(*=20.6=20=
(+=2065535=2065535=2065535)))=0A+=20=20(when=20(color-dark-p=20(mapcar=20=
(lambda=20(c)=20(/=20c=2065535.0))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(list=20redc=20=
greenc=20bluec)))=0A=20=20=20=20=20(set-terminal-parameter=20nil=20=
'background-mode=20'dark)=0A=20=20=20=20=20t))=0A=20=0Adiff=20--git=20=
a/lisp/textmodes/css-mode.el=20b/lisp/textmodes/css-mode.el=0Aindex=20=
eda739a397..2cd99787e8=20100644=0A---=20a/lisp/textmodes/css-mode.el=0A=
+++=20b/lisp/textmodes/css-mode.el=0A@@=20-1149,17=20+1149,6=20@@=20=
css--compute-color=0A=20=20=20=20;;=20Evaluate=20to=20the=20color=20if=20=
the=20name=20is=20found.=0A=20=20=20=20((css--named-color=20start-point=20=
match))))=0A=20=0A-(defun=20css--contrasty-color=20(name)=0A-=20=20=
"Return=20a=20color=20that=20contrasts=20with=20NAME.=0A-NAME=20is=20of=20=
any=20form=20accepted=20by=20`color-distance'.=0A-The=20returned=20color=20=
will=20be=20usable=20by=20Emacs=20and=20will=20contrast=0A-with=20NAME;=20=
in=20particular=20so=20that=20if=20NAME=20is=20used=20as=20a=20=
background=0A-color,=20the=20returned=20color=20can=20be=20used=20as=20=
the=20foreground=20and=20still=0A-be=20readable."=0A-=20=20;;=20See=20=
bug#25525=20and=20bug#41544=20for=20a=20discussion=20of=20this.=0A-=20=20=
(if=20(>=20(color-distance=20name=20"black")=20138500)=0A-=20=20=20=20=20=
=20"black"=20"white"))=0A-=0A=20(defcustom=20css-fontify-colors=20t=0A=20=
=20=20"Whether=20CSS=20colors=20should=20be=20fontified=20using=20the=20=
color=20as=20the=20background.=0A=20When=20non-`nil',=20a=20text=20=
representing=20CSS=20color=20will=20be=20fontified=0A@@=20-1199,7=20=
+1188,8=20@@=20css--fontify-region=0A=20=09=09=20=20=20=20=
(add-text-properties=0A=20=09=09=20=20=20=20=20start=20(point)=0A=20=09=09=
=20=20=20=20=20(list=20'face=20(list=20:background=20color=0A-=09=09=09=09=
=20=20=20=20=20=20=20:foreground=20(css--contrasty-color=20color)=0A+=09=09=
=09=09=20=20=20=20=20=20=20:foreground=20(readable-foreground-color=0A+=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20color)=0A=20=09=09=09=09=20=20=20=20=20=20=20:box=20'(:line-width=20=
-1))))))))))))=0A=20=20=20=20=20extended-region))=0A=20=0A--=20=0A2.21.1=20=
(Apple=20Git-122.3)=0A=0A=

--Apple-Mail=_7FF6E8CE-41E3-44BB-A837-E0A212C5FA1B
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii




--Apple-Mail=_7FF6E8CE-41E3-44BB-A837-E0A212C5FA1B--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 29 May 2020 17:52:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 29 13:52:13 2020
Received: from localhost ([127.0.0.1]:56174 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jejAz-0002BU-Mf
	for submit <at> debbugs.gnu.org; Fri, 29 May 2020 13:52:13 -0400
Received: from gateway31.websitewelcome.com ([192.185.143.47]:49310)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tom@HIDDEN>) id 1jejAx-0002BM-Lj
 for 41544 <at> debbugs.gnu.org; Fri, 29 May 2020 13:52:12 -0400
Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5])
 by gateway31.websitewelcome.com (Postfix) with ESMTP id E924C8B24
 for <41544 <at> debbugs.gnu.org>; Fri, 29 May 2020 12:52:10 -0500 (CDT)
Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP
 id ejAwji4G3Sl8qejAwjxJcZ; Fri, 29 May 2020 12:52:10 -0500
X-Authority-Reason: nr=8
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; 
 s=default;
 h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=2+/rdbBHYCebM5YSAUsg/EWrBF3LOO92jaxFrFE8f90=; b=dpkkbiunmgP46ms1jDa9SMQrOe
 mtQsfTmLcoM/RTWQo6brDvS+3FjC4oLh3+oDHxIYEEEAbabxAMl5NvkJa6SX0Kmz9vb7IijIIAz7E
 9dag0/4jyNRr7weS1dpj3/Bbg;
Received: from 174-16-104-48.hlrn.qwest.net ([174.16.104.48]:49074
 helo=murgatroyd)
 by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
 (Exim 4.92) (envelope-from <tom@HIDDEN>)
 id 1jejAw-000ru1-D5; Fri, 29 May 2020 11:52:10 -0600
From: Tom Tromey <tom@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN>
X-Attribution: Tom
Date: Fri, 29 May 2020 11:52:08 -0600
In-Reply-To: <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> ("Mattias
 =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Fri, 29 May 2020 17:17:41
 +0200")
Message-ID: <87r1v2aat3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - box5379.bluehost.com
X-AntiAbuse: Original Domain - debbugs.gnu.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - tromey.com
X-BWhitelist: no
X-Source-IP: 174.16.104.48
X-Source-L: No
X-Exim-ID: 1jejAw-000ru1-D5
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-Source-Sender: 174-16-104-48.hlrn.qwest.net (murgatroyd)
 [174.16.104.48]:49074
X-Source-Auth: tom+tromey.com
X-Email-Count: 3
X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20=
X-Local-Domain: yes
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 41544
Cc: Tom Tromey <tom@HIDDEN>, Simon Pugnet <simon@HIDDEN>,
 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

Mattias> Try the attached patch. A couple of constants used for
Mattias> comparison were recomputed, but since they mostly appeared to
Mattias> have been picked out of thin air, I didn't bother attempting a
Mattias> very precise translation.

Thank you for doing this.

I wasn't sure whether Emacs would accept a patch changing the return
value in this way.

However, my main concern is just whether it still picks reasonably
contrasting colors when editing CSS.  If it does, then that's good
enough for me.

thanks,
Tom




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 29 May 2020 17:28:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 29 13:28:58 2020
Received: from localhost ([127.0.0.1]:56101 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jeioU-0001Z4-82
	for submit <at> debbugs.gnu.org; Fri, 29 May 2020 13:28:58 -0400
Received: from mail1454c50.megamailservers.eu ([91.136.14.54]:44246
 helo=mail266c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jeioR-0001Ym-U0
 for 41544 <at> debbugs.gnu.org; Fri, 29 May 2020 13:28:56 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1590773328;
 bh=t34qr4VfLJe8hwaTHC9A99DXmRZmQkEj1u7Ng2eo2Io=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=GDO9Rt9R2iuT953isbHi4pTh1rvJCQWHQc9hRiXdjcuGbavE5gXn7u/Fw0aYaBAaC
 Ic+o+Jwd0WnzS+j/HmAYDup3GCOgjLv/msA5Q08FwJR4xA59/z4BT7KSWFfWbcIGPj
 aHt27/H4tWcR0dHdFTHl1jiVINzxnLOFbSZ8dq08=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail266c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 04THSiV4015235; 
 Fri, 29 May 2020 17:28:46 +0000
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <83pnamn47h.fsf@HIDDEN>
Date: Fri, 29 May 2020 19:28:44 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <94FCD141-F201-49D1-BDAD-9FFA46D48D6D@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> <83pnamn47h.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F28.5ED14602.001D:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=A5MSwJeG c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10
 a=mDV3o1hIAAAA:8 a=cUxbU7hPt0qoel6uMsQA:9 a=CjuIK1q_8ugA:10
 a=_FVE-zBwftR9WsbkzFJk:22
X-Spam-Score: 1.4 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  29 maj 2020 kl. 17.36 skrev Eli Zaretskii <eliz@HIDDEN>:
 > Did you try what this does to tty-color-approximate and friends, > especially
 when the terminal supports only 8 or 16 colors? If not, > please do, we must
 ensure there are no regressions there. 
 Content analysis details:   (1.4 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: megamailservers.eu]
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.4 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

29 maj 2020 kl. 17.36 skrev Eli Zaretskii <eliz@HIDDEN>:

> Did you try what this does to tty-color-approximate and friends,
> especially when the terminal supports only 8 or 16 colors?  If not,
> please do, we must ensure there are no regressions there.

tty-color-approximate uses its own metric (square of the unweighted =
Euclidian RGB distance).
To test the TTY_SAME_COLOR_THRESHOLD, I tried =
display-supports-face-attributes-p, and it seems to behave in the same =
way. All tested with TERM=3Dxterm-color, which gives the standard 8 =
colours.

The translated constants were obtained by generating many random RGB =
triples and computing distances between all pairs, then finding the =
value of NEWCONST which minimises the number of cases where

  old-colour-dist(c1,c2) < OLDCONST

and

  new-colour-dist(c1,c2) < NEWCONST

differ in truth value. The computation was also run on the rgb.txt list =
instead of random colours as an extra check.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 29 May 2020 15:36:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 29 11:36:33 2020
Received: from localhost ([127.0.0.1]:55848 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jeh3h-0006p0-Cj
	for submit <at> debbugs.gnu.org; Fri, 29 May 2020 11:36:33 -0400
Received: from eggs.gnu.org ([209.51.188.92]:41332)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jeh3f-0006ol-BL
 for 41544 <at> debbugs.gnu.org; Fri, 29 May 2020 11:36:31 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:41261)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jeh3Z-0005nw-Lr; Fri, 29 May 2020 11:36:25 -0400
Received: from [176.228.60.248] (port=2302 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jeh3Y-0003po-53; Fri, 29 May 2020 11:36:24 -0400
Date: Fri, 29 May 2020 18:36:18 +0300
Message-Id: <83pnamn47h.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN> (message from
 Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Fri, 29 May 2020 17:17:41 +0200)
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
 <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41544
Cc: tom@HIDDEN, simon@HIDDEN, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Mattias EngdegÄrd <mattiase@HIDDEN>
> Date: Fri, 29 May 2020 17:17:41 +0200
> Cc: Tom Tromey <tom@HIDDEN>, 41544 <at> debbugs.gnu.org
> 
>  /* If the distance (as returned by color_distance) between two colors is
>     less than this, then they are considered the same, for determining
> -   whether a color is supported or not.  The range of values is 0-65535.  */
> +   whether a color is supported or not.  */
>  
> -#define TTY_SAME_COLOR_THRESHOLD  10000
> +#define TTY_SAME_COLOR_THRESHOLD  25000

Did you try what this does to tty-color-approximate and friends,
especially when the terminal supports only 8 or 16 colors?  If not,
please do, we must ensure there are no regressions there.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.
Added tag(s) patch. Request was from Mattias EngdegÄrd <mattiase@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 29 May 2020 15:17:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 29 11:17:49 2020
Received: from localhost ([127.0.0.1]:55815 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jeglZ-0004AZ-Cu
	for submit <at> debbugs.gnu.org; Fri, 29 May 2020 11:17:49 -0400
Received: from mail237c50.megamailservers.eu ([91.136.10.247]:59656
 helo=mail56c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>)
 id 1jeglX-0004AK-04; Fri, 29 May 2020 11:17:47 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1590765465;
 bh=6AGewmx6FJbCD16+LEByyLmfff9r5+BfFD/QIb88nqs=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=qkBXcIij+X4b8i0nNpHJOwpjAUrtVGHm6SYyMEU5KU7Xd/KQKN6VwUf1p+DyhiFKp
 pGMYxjLkhCTRKqSvjXqKuAQjwGpYu9FXbqDNYKwFbxk952KXLru+jMpuzLDVzerSAI
 JZUyHDsqXeHyVbLYsM0Ri4UOJ+8sHcbIGW1yKk1E=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail56c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 04TFHfUm028844; 
 Fri, 29 May 2020 15:17:43 +0000
Content-Type: multipart/mixed;
 boundary="Apple-Mail=_67070B8E-0C26-4D1D-B8AF-7A37D74DD869"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: Re: bug#41544: 26.3; Possible incorrect results from color-distance
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
In-Reply-To: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
Date: Fri, 29 May 2020 17:17:41 +0200
Message-Id: <DBC83DAA-B758-45D7-8AB8-708C9C5C6A77@HIDDEN>
References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
To: Simon Pugnet <simon@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F1C.5ED12751.006D:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=UqsdyN4B c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=M51BFTxLslgA:10 a=L-gs6BjLIPZIF3TP3vUA:9
 a=CjuIK1q_8ugA:10 a=fNRX9wVF-h2nzrGUox4A:9 a=B2y7HmGcmWMA:10
X-Spam-Score: 1.4 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  tags 41544 patch stop Try the attached patch. A couple of
 constants used for comparison were recomputed, but since they mostly appeared
 to have been picked out of thin air, I didn't bother attempting a very precise
 transla [...] 
 Content analysis details:   (1.4 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: megamailservers.eu]
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.4 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 41544
Cc: Tom Tromey <tom@HIDDEN>, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)


--Apple-Mail=_67070B8E-0C26-4D1D-B8AF-7A37D74DD869
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

tags 41544 patch
stop

Try the attached patch. A couple of constants used for comparison were =
recomputed, but since they mostly appeared to have been picked out of =
thin air, I didn't bother attempting a very precise translation.


--Apple-Mail=_67070B8E-0C26-4D1D-B8AF-7A37D74DD869
Content-Disposition: attachment;
	filename=0001-Make-color-distance-into-a-proper-distance-metric-bu.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="0001-Make-color-distance-into-a-proper-distance-metric-bu.patch"
Content-Transfer-Encoding: quoted-printable

=46rom=20f0eab8ad402baf8c4c790e685e84f3f89b1d6ecd=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20=
<mattiase@HIDDEN>=0ADate:=20Fri,=2029=20May=202020=2017:07:59=20+0200=0A=
Subject:=20[PATCH]=20Make=20color-distance=20into=20a=20proper=20=
distance=20metric=20(bug#41544)=0A=0AThe=20previous=20function=20=
discarded=20bits=20in=20the=20arguments,=20was=20not=0Asymmetric,=20and=20=
did=20not=20obey=20the=20triangle=20equality;=20the=20return=20value=0A=
was=20quadratic=20in=20the=20perceived=20colour=20distance=20instead=20=
of=20linear.=0A=0AReported=20by=20Simon=20Pugnet.=0A=0A*=20src/xfaces.c=20=
(color_distance):=20Use=20all=2016=20bits=20per=20channel=20and=0Aadd=20=
the=20missing=20square=20root=20operation.=0A(TTY_SAME_COLOR_THRESHOLD,=20=
syms_of_xfaces):=0A*=20lisp/textmodes/css-mode.el=20=
(css--contrasty-color):=0AUpdate=20colour=20distance=20constants=20to=20=
values=20appropriate=20for=20the=20new=0Afunction.=0A---=0A=20etc/NEWS=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=206=20++++++=0A=
=20lisp/textmodes/css-mode.el=20|=20=204=20++--=0A=20src/xfaces.c=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20|=2022=20+++++++++++-----------=0A=20=
3=20files=20changed,=2019=20insertions(+),=2013=20deletions(-)=0A=0Adiff=20=
--git=20a/etc/NEWS=20b/etc/NEWS=0Aindex=2064cf0abbdb..d8470223e5=20=
100644=0A---=20a/etc/NEWS=0A+++=20b/etc/NEWS=0A@@=20-489,6=20+489,12=20=
@@=20Use=20macro=20'with-current-buffer-window'=20with=20action=20alist=20=
entry=20'body-function'.=0A=20**=20Some=20libraries=20obsolete=20since=20=
Emacs=2023=20have=20been=20removed:=0A=20'ledit.el',=20'lmenu.el',=20=
'lucid.el=20and=20'old-whitespace.el'.=0A=20=0A+---=0A+**=20The=20=
'color-distance'=20function=20is=20now=20a=20proper=20distance=20metric.=0A=
+It=20was=20previously=20not=20symmetric,=20nor=20did=20it=20obey=20the=20=
triangle=20equality.=0A+The=20default=20value=20of=20the=20=
'face-near-same-color-threshold'=20variable=20has=0A+been=20updated=20to=20=
a=20number=20that=20roughly=20corresponds=20to=20the=20same=20distance.=0A=
+=0A=20=0C=0A=20*=20Lisp=20Changes=20in=20Emacs=2028.1=0A=20=0Adiff=20=
--git=20a/lisp/textmodes/css-mode.el=20b/lisp/textmodes/css-mode.el=0A=
index=200035c5e7b0..eda739a397=20100644=0A---=20=
a/lisp/textmodes/css-mode.el=0A+++=20b/lisp/textmodes/css-mode.el=0A@@=20=
-1156,8=20+1156,8=20@@=20css--contrasty-color=0A=20with=20NAME;=20in=20=
particular=20so=20that=20if=20NAME=20is=20used=20as=20a=20background=0A=20=
color,=20the=20returned=20color=20can=20be=20used=20as=20the=20=
foreground=20and=20still=0A=20be=20readable."=0A-=20=20;;=20See=20=
bug#25525=20for=20a=20discussion=20of=20this.=0A-=20=20(if=20(>=20=
(color-distance=20name=20"black")=20292485)=0A+=20=20;;=20See=20=
bug#25525=20and=20bug#41544=20for=20a=20discussion=20of=20this.=0A+=20=20=
(if=20(>=20(color-distance=20name=20"black")=20138500)=0A=20=20=20=20=20=20=
=20"black"=20"white"))=0A=20=0A=20(defcustom=20css-fontify-colors=20t=0A=
diff=20--git=20a/src/xfaces.c=20b/src/xfaces.c=0Aindex=20=
7d7aff95c1..e828c12f09=20100644=0A---=20a/src/xfaces.c=0A+++=20=
b/src/xfaces.c=0A@@=20-218,6=20+218,7=20@@=20Copyright=20(C)=20=
1993-1994,=201998-2020=20Free=20Software=20Foundation,=20Inc.=0A=20=
#include=20<config.h>=0A=20#include=20<stdlib.h>=0A=20#include=20=
"sysstdio.h"=0A+#include=20<math.h>=0A=20#include=20<sys/types.h>=0A=20=
#include=20<sys/stat.h>=0A=20=0A@@=20-4356,15=20+4357,14=20@@=20=
color_distance=20(Emacs_Color=20*x,=20Emacs_Color=20*y)=0A=20=0A=20=20=20=
=20=20=20See=20<https://www.compuphase.com/cmetric.htm>=20for=20more=20=
info.=20=20*/=0A=20=0A-=20=20long=20r=20=3D=20(x->red=20=20=20-=20=
y->red)=20=20=20>>=208;=0A-=20=20long=20g=20=3D=20(x->green=20-=20=
y->green)=20>>=208;=0A-=20=20long=20b=20=3D=20(x->blue=20=20-=20y->blue)=20=
=20>>=208;=0A-=20=20long=20r_mean=20=3D=20(x->red=20+=20y->red)=20>>=20=
9;=0A+=20=20long=20long=20r=20=3D=20x->red=20=20=20-=20y->red;=0A+=20=20=
long=20long=20g=20=3D=20x->green=20-=20y->green;=0A+=20=20long=20long=20=
b=20=3D=20x->blue=20=20-=20y->blue;=0A+=20=20long=20long=20r_mean=20=3D=20=
(x->red=20+=20y->red)=20>>=201;=0A=20=0A-=20=20return=0A-=20=20=20=20=
(((512=20+=20r_mean)=20*=20r=20*=20r)=20>>=208)=0A-=20=20=20=20+=204=20*=20=
g=20*=20g=0A-=20=20=20=20+=20(((767=20-=20r_mean)=20*=20b=20*=20b)=20>>=20=
8);=0A+=20=20return=20(int)=20sqrt=20((((2=20*=2065536=20+=20r_mean)=20*=20=
r=20*=20r)=20>>=2016)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20+=204=20*=20g=20*=20g=0A+=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20+=20(((2=20*=2065536=20+=2065535=20-=20=
r_mean)=20*=20b=20*=20b)=20>>=2016));=0A=20}=0A=20=0A=20=0A@@=20-4931,9=20=
+4931,9=20@@=20DEFUN=20("face-attributes-as-vector",=20=
Fface_attributes_as_vector,=0A=20=0A=20/*=20If=20the=20distance=20(as=20=
returned=20by=20color_distance)=20between=20two=20colors=20is=0A=20=20=20=
=20less=20than=20this,=20then=20they=20are=20considered=20the=20same,=20=
for=20determining=0A-=20=20=20whether=20a=20color=20is=20supported=20or=20=
not.=20=20The=20range=20of=20values=20is=200-65535.=20=20*/=0A+=20=20=20=
whether=20a=20color=20is=20supported=20or=20not.=20=20*/=0A=20=0A=
-#define=20TTY_SAME_COLOR_THRESHOLD=20=2010000=0A+#define=20=
TTY_SAME_COLOR_THRESHOLD=20=2025000=0A=20=0A=20#ifdef=20=
HAVE_WINDOW_SYSTEM=0A=20=0A@@=20-7008,7=20+7008,7=20@@=20syms_of_xfaces=20=
(void)=0A=20=0A=20Lisp=20programs=20that=20change=20the=20value=20of=20=
this=20variable=20should=20also=0A=20clear=20the=20face=20cache,=20see=20=
`clear-face-cache'.=20=20*/);=0A-=20=20face_near_same_color_threshold=20=
=3D=2030000;=0A+=20=20face_near_same_color_threshold=20=3D=2044300;=0A=20=
=0A=20#ifdef=20HAVE_WINDOW_SYSTEM=0A=20=20=20defsubr=20=
(&Sbitmap_spec_p);=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A=0A=

--Apple-Mail=_67070B8E-0C26-4D1D-B8AF-7A37D74DD869--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at 41544 <at> debbugs.gnu.org:


Received: (at 41544) by debbugs.gnu.org; 28 May 2020 17:32:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 28 13:32:01 2020
Received: from localhost ([127.0.0.1]:52960 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jeMNq-00071a-Aj
	for submit <at> debbugs.gnu.org; Thu, 28 May 2020 13:32:01 -0400
Received: from mail223c50.megamailservers.eu ([91.136.10.233]:40682
 helo=mail33c50.megamailservers.eu)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mattiase@HIDDEN>) id 1jeMNo-00071S-VJ
 for 41544 <at> debbugs.gnu.org; Thu, 28 May 2020 13:31:57 -0400
X-Authenticated-User: mattiase@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu;
 s=maildub; t=1590687114;
 bh=Yasi4sRb1zKngiAa7lQrTx2do4QJcOubwplCyGiejhk=;
 h=From:Subject:Date:Cc:To:From;
 b=VP62f5XJ/YhUfdjMe1z3bBLUnfQRYAaxhM5N1mgqMBYXRhU+0QK1d+ggG8gja0GbN
 p2rOWpYCBS1qY0A4iu6ex4KTJbZ51rxlMMPEhowhchQuSIFMw3h7yQ1qMKhJgi99gu
 yUMtFZSAiZIfzD7Tmr89vQypaKzTogSZbdhWoiqM=
Feedback-ID: mattiase@HIDDEN
Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se
 [85.230.74.78]) (authenticated bits=0)
 by mail33c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 04SHVp2O000373; 
 Thu, 28 May 2020 17:31:53 +0000
From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN>
Content-Type: text/plain;
	charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\))
Subject: bug#41544: 26.3; Possible incorrect results from color-distance
Message-Id: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@HIDDEN>
Date: Thu, 28 May 2020 19:31:51 +0200
To: Simon Pugnet <simon@HIDDEN>
X-Mailer: Apple Mail (2.3445.104.14)
X-CTCH-RefID: str=0001.0A782F17.5ECFF520.003D:SCFSTAT68638221, ss=1, re=-4.000,
 recu=0.000, reip=0.000, cl=1, cld=1, fgs=0
X-CTCH-VOD: Unknown
X-CTCH-Spam: Unknown
X-CTCH-Score: -4.000
X-CTCH-Rules: 
X-CTCH-Flags: 0
X-CTCH-ScoreCust: 0.000
X-CSC: 0
X-CHA: v=2.3 cv=eaJDgIMH c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117
 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10
 a=XxNu1oolT2MRe3TBGnIA:9 a=CjuIK1q_8ugA:10
X-Spam-Score: 1.4 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  [CC:ing Tom Tromey, who used colour-distance in css-mode]
 Ah, where to begin. Clearly a distance metric ought to be symmetric; as you
 note, this is easily fixed by replacing the shift by division, which has
 the extra benefit of not relying on the implementat [...] 
 Content analysis details:   (1.4 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: megamailservers.eu]
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.4 KHOP_HELO_FCRDNS       Relay HELO differs from its IP's reverse DNS
X-Debbugs-Envelope-To: 41544
Cc: Tom Tromey <tom@HIDDEN>, 41544 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

[CC:ing Tom Tromey, who used colour-distance in css-mode]

Ah, where to begin. Clearly a distance metric ought to be symmetric; as =
you note, this is easily fixed by replacing the shift by division, which =
has the extra benefit of not relying on the implementation-defined =
behaviour when right-shifting negative values in C. The extra cost is =
negligible.

Looking at it a bit closer, it seems a waste to use full 16 bit colour =
channels only to shift out 8 of them before getting started. I presume =
this was done partly in order to follow the Riedersma metric more =
closely, and partly to stay within 32 bit numbers (I note that the code =
uses the C 'long' type, which is almost always a mistake). Using 64-bit =
arithmetic costs us next to nothing today, and this solves several =
problems.

But a darker cloud is on the horizon. Since the Emacs implementation =
omits the square root of the result, it no longer satisfies the triangle =
inequality, which is even more fundamental for distance metrics than =
symmetry. It is good enough for comparison of distances, but they can no =
longer be added, since it's not a true metric.

In fact, it seems that users of color_distance are confused as well: a =
comment says

  /* If the distance (as returned by color_distance) between two colors =
is
     less than this, then they are considered the same, for determining
     whether a color is supported or not.  The range of values is =
0-65535.  */

  #define TTY_SAME_COLOR_THRESHOLD  10000

which is a lie, since color_distance can return values well above 65535.
Some uses are very questionable, given that it's the square of a metric:

      int delta_delta
	=3D (color_distance (&fg_std_color, &bg_std_color)
	   - color_distance (&fg_tty_color, &bg_tty_color));
      if (delta_delta > TTY_SAME_COLOR_THRESHOLD
	  || delta_delta < -TTY_SAME_COLOR_THRESHOLD)

So what to do? Best would be to do the arithmetic on the entire channel =
values and take the square root at the end; the cost is nothing to worry =
about on hardware less than 30 years old. Some constants used for =
comparison would need to be adjusted: the above-mentioned =
TTY_SAME_COLOR_THRESHOLD (10000), face-near-same-threshold (30000), and =
a number in css--contrasty-color (292485).  At least the last should =
probably use the luma norm originally proposed instead (see bug#25525); =
the use of colour-distance here cannot be right.






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 May 2020 16:33:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 26 12:33:53 2020
Received: from localhost ([127.0.0.1]:46285 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jdcWW-00074o-7o
	for submit <at> debbugs.gnu.org; Tue, 26 May 2020 12:33:53 -0400
Received: from lists.gnu.org ([209.51.188.17]:56180)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <simon.pugnet@HIDDEN>) id 1jdcSB-0006xQ-Vo
 for submit <at> debbugs.gnu.org; Tue, 26 May 2020 12:29:24 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:55560)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <simon.pugnet@HIDDEN>)
 id 1jdcSB-0003Ri-OL
 for bug-gnu-emacs@HIDDEN; Tue, 26 May 2020 12:29:23 -0400
Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:41656)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <simon.pugnet@HIDDEN>)
 id 1jdcSA-0002AM-OF
 for bug-gnu-emacs@HIDDEN; Tue, 26 May 2020 12:29:23 -0400
Received: by mail-ed1-x52e.google.com with SMTP id g9so18157508edr.8
 for <bug-gnu-emacs@HIDDEN>; Tue, 26 May 2020 09:29:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:user-agent:from:to:subject:date:message-id:mime-version;
 bh=Ygv0y36F2M0o2eiv0rVcXfxE2lsx9jISFI1OTaZl6Js=;
 b=BTsOnbiozsnmsJU5tNQOjCJHLK4LJ8Peew+OsCBHIVSo3HUlVcWmJJebPXEMsCpjHF
 YSdaOT67FEJuTpx+ZpUaIambA9X72CHkHkKzbyAuvSVjSySGXWml/HgD+dOEZht6qMN6
 WQZW1gP+soFOWjtxedCE8Tl1lubaRWCGsqq6dOBF2w5UjAtkrikI2xjO6WUojikVpKh5
 dmRQv9kSYmZGeByxCvBzk1sA0FqWAlIk4vA2jklGa+L2nIUKGAjIwqMN+1dyZ4sx7+tL
 VJWT5tMbBzyTBokMOj483oNgrD8NvPuLepLcOrD84OjsEFqzBB8YvaxtrcxAW5DJYJwv
 iH3w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:user-agent:from:to:subject:date
 :message-id:mime-version;
 bh=Ygv0y36F2M0o2eiv0rVcXfxE2lsx9jISFI1OTaZl6Js=;
 b=oZWzz9pjjLRnehcYNiFkFfNQV+SKM/jwTbByYVUQe/oAq9PbylRFHOHMdPpvTVgjtR
 juWCBfBWWwNLG0ngyquQ4/+lHgSqtlC0vyoxl5mLLz92u7+xbhFE5udWf3zr8tNTMLbx
 NRdCiOw1FsbgDl9LLUT1zQBH7JmrqFmVTa1Uw1f3fRu2QWv41B2ZHlLKiHVyWVQEP+gx
 OyH8uB6eB4V3Yqx5Mdqh8laLFEGAuJZ462f2vt9/KTKX7eB+MG4GhX0C3hjASrYwZsnP
 lhlJot4V/bDyG285Mv06FnbdEBaC+rqsy9j8ynYKsZsYb3JZhd10+6mVNyZpXE/xcZXl
 D1ag==
X-Gm-Message-State: AOAM530tteDcmRNDjUs8Cg/8y/pI8iMXQk8HGy8e0gtEv6iS8ZXYOIA0
 kc0lr7oUHDfi8x96o5kehhL3Nh3w
X-Google-Smtp-Source: ABdhPJx7pm/cfc3tF/8VIw/OQaqWZCn8+FVGpOwf7cvXL1Z3Fr641hmKgFaYVNXmEuXn9buuLNmymQ==
X-Received: by 2002:a05:6402:2058:: with SMTP id
 bc24mr21034906edb.134.1590510559854; 
 Tue, 26 May 2020 09:29:19 -0700 (PDT)
Received: from karnak (25-56.dsl.iskon.hr. [89.164.25.56])
 by smtp.gmail.com with ESMTPSA id a3sm303413edv.70.2020.05.26.09.29.18
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 26 May 2020 09:29:18 -0700 (PDT)
User-agent: mu4e 1.2.0; emacs 26.3
From: Simon Pugnet <simon@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 26.3; Possible incorrect results from color-distance
Date: Tue, 26 May 2020 17:29:16 +0100
Message-ID: <874ks2vew3.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
Received-SPF: pass client-ip=2a00:1450:4864:20::52e;
 envelope-from=simon.pugnet@HIDDEN; helo=mail-ed1-x52e.google.com
X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache.
 That's all we know.
X-Spam_score_int: -16
X-Spam_score: -1.7
X-Spam_bar: -
X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
 FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001,
 URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Hello, I have noticed some potentially incorrect behaviour
 from the `color-distance` elisp function. As an example, take the following
 elisp: - (list (color-distance '(0 0 0) '(65535 65535 65535)) (color-distance
 '(65535 65535 65535) '(0 0 0)) (color-distance '(1 2 3) '(4 5 6))
 (color-distance '(4 5 [...] 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: x.org]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level
 mail domains are different
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (simon.pugnet[at]gmail.com)
 -2.3 RCVD_IN_DNSWL_MED      RBL: Sender listed at https://www.dnswl.org/,
 medium trust [209.51.188.17 listed in list.dnswl.org]
 0.0 RCVD_IN_MSPIKE_H4      RBL: Very Good reputation (+4)
 [209.51.188.17 listed in wl.mailspike.net]
 0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and
 EnvelopeFrom freemail headers are different
 2.0 SPOOFED_FREEMAIL       No description available.
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 26 May 2020 12:33:51 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.8 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Hello,

I have noticed some potentially incorrect behaviour from the
`color-distance` elisp function.

As an example, take the following elisp: -
(list
 (color-distance '(0 0 0) '(65535 65535 65535))
 (color-distance '(65535 65535 65535) '(0 0 0))
 (color-distance '(1 2 3) '(4 5 6))
 (color-distance '(4 5 6) '(1 2 3)))

Result: (589568 584970 8 0)

Here, I would expect the first two elements to have the same=20
result as
well as the third and fourth. This is because conceptually the=20
distance
between colour (1 2 3) and (4 5 6) is the same as the distance=20
between
(4 5 6) and (1 2 3), etc.

The problem comes from the `color_distance()` C function. In this
function, values are calculated via bit shifts to perform integer
divisions of 256 (>>8) and 512 (>>9). Take for example the 3rd and=20
4th
items above (red channel): -
1 - 4 =3D -3
4 - 1 =3D 3
but: -
(1 - 4) >> 8 =3D -1
(4 - 1) >> 8 =3D 0

Therefore for negative values, there is a difference of 1 every=20
time the
bit shift is performed, which is what leads to the discrepancy=20
mentioned
above.

Modifying the function to remove these discrepancies causes the=20
results
above to become (584970 584970 0 0) which appear to be more=20
sensible.

My apologies in advance if this is in fact the correct behaviour=20
of this
function.

Kind regards,

=2D-
Simon Pugnet
https://www.polaris64.net/

=2D--

In GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version=20
3.24.14)
 of 2020-03-26, modified by Debian built on lcy01-amd64-020
Windowing system distributor 'The X.Org Foundation', version=20
11.0.12008000
System Description:	Ubuntu 20.04 LTS

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set
(589568 584970 8 0)
You can run the command =E2=80=98eval-print-last-sexp=E2=80=99 with C-j
Mark activated
kill-line: End of buffer
Making completion list...
You can run the command =E2=80=98kill-region=E2=80=99 with C-w

Configured using:
 'configure --build x86_64-linux-gnu --prefix=3D/usr
 --sharedstatedir=3D/var/lib --libexecdir=3D/usr/lib
 --localstatedir=3D/var/lib --infodir=3D/usr/share/info
 --mandir=3D/usr/share/man --enable-libsystemd --with-pop=3Dyes
 --enable-locallisppath=3D/etc/emacs:/usr/local/share/emacs/26.3/site-lisp:=
/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.3/site-lisp:/usr/share=
/emacs/site-lisp
 --with-sound=3Dalsa --without-gconf --with-mailutils --build
 x86_64-linux-gnu --prefix=3D/usr --sharedstatedir=3D/var/lib
 --libexecdir=3D/usr/lib --localstatedir=3D/var/lib
 --infodir=3D/usr/share/info --mandir=3D/usr/share/man=20
 --enable-libsystemd
 --with-pop=3Dyes
 --enable-locallisppath=3D/etc/emacs:/usr/local/share/emacs/26.3/site-lisp:=
/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.3/site-lisp:/usr/share=
/emacs/site-lisp
 --with-sound=3Dalsa --without-gconf --with-mailutils --with-x=3Dyes
 --with-x-toolkit=3Dgtk3 --with-toolkit-scroll-bars 'CFLAGS=3D-g -O2
 -fdebug-prefix-map=3D/build/emacs-mEZBk7/emacs-26.3+1=3D.=20
 -fstack-protector-strong
 -Wformat -Werror=3Dformat-security -Wall' 'CPPFLAGS=3D-Wdate-time
 -D_FORTIFY_SOURCE=3D2' 'LDFLAGS=3D-Wl,-Bsymbolic-functions=20
 -Wl,-z,relro''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS=20
GLIB
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT=20
ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS LIBSYSTEMD LCMS2

Important settings:
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: @im=3Dnone
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired=20
dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived=20
epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies=20
mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail=20
rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair=20
time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd=20
tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace=20
newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock=20
font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham=20
georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech=20
european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray=20
minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting=20
font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 95338 8459)
 (symbols 48 20386 1)
 (miscs 40 50 168)
 (strings 32 28445 1160)
 (string-bytes 1 747812)
 (vectors 16 13900)
 (vector-slots 8 500980 11290)
 (floats 8 51 264)
 (intervals 56 301 25)
 (buffers 992 12))

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEO/eF3hYsAMj7Tab9uhNZqCwLPvkFAl7NQ9wACgkQuhNZqCwL
PvnI3g//fDYKiUcyxn3W/fHed3y3cjPc1HkkB/0o5pnwfe+zK2W7Ldp2Q/xZwpE3
P2mPXDMIUzxP8XgIUR/IgyMWJytTKE68ifUuy9WT8iRPjoNSq7U7JtbM/1xUUzlJ
3735l1X4MPcrX2MwV27oqVb52a2UZLVlL5+9GYu1Wr5UeTTx9Mzm5RmcI009dtp5
C8QkP4/uls+U/hEsk0tNKocMROMzDX3K3J7tFe4KlIkIktjU8A9Fc0cmCfOnKsR3
SjHeyKhfRnFAmarrrAXhTduFN3lCfBh2HK+MpeoZ5ba4f+RQpjRPmuBdwWeuGMtQ
Oy0Bhx4Q3iMyd1zezDy2p3ax/qyhyiHgWk9EPo7T5T0ILEvpA3XuPRyStux4gEX8
Fxcaf9r8va/n++if4hY/oJmATMmWNfjFM1p3gPM4CMDUPdd1tORqvDvUdKFeCs/7
dYYQ0keUuGDNyBkqvxrZT1dpvrGky2pg+YSOy2tVNdDQjC3x1N8kXMDn3LMlAmp+
ZEXzdMqrHyodIzLf3eIaejqmnNb/wWmpOcD9O1StQGS81AvFL89qc0cqPqEAUScl
FG9Ot3EF5tAKap/TxScgLdSpJjEDrh7zvWAXMRsikXSCsVPgybXM0Ju1INLXWveR
cEn6kKpc574TqroYYqnse6rmrAamh+ev3xGg9ukvw+kYFCSou/4=
=HoyA
-----END PGP SIGNATURE-----
--=-=-=--




Acknowledgement sent to Simon Pugnet <simon@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#41544; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 7 Jun 2020 19:30:03 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.