From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#41544: 26.3; Possible incorrect results from color-distance Date: Sun, 7 Jun 2020 09:00:34 -0700 (PDT) Message-ID: <93fdabf1-f725-4e8c-a9de-8e4c61ff7973@default> References: <5C4A633D-8222-4439-BE37-9B8674F1DA6D@acm.org> <87r1v2aat3.fsf@tromey.com> <9902865C-01B4-4E50-A433-DBC8B8311234@acm.org> <83tuzueogo.fsf@gnu.org> <6272275C-560C-4437-90F1-2A8294D27019@acm.org> <83o8q2elja.fsf@gnu.org> <83mu5mel4o.fsf@gnu.org> <77F1DDD3-A69F-40ED-902D-74986D5E6596@acm.org> <83y2p5cumz.fsf@gnu.org> <83blm0cjlz.fsf@gnu.org> <83367ccf8w.fsf@gnu.org> <624D7FB8-A836-4A7E-8895-47E867214504@acm.org> <83o8pyc4bq.fsf@gnu.org> <55D73CA5-1EFB-4B0A-8F8B-FDA1D39F51BF@acm.org> <835zc5bsut.fsf@gnu.org> <3BBCFDD4-C14D-4628-91CB-2A0456A96FC7@acm.org> <838sh0abzz.fsf@gnu.org> <83r1us8kw6.fsf@gnu.org> <020DE875-14A8-457A-9AE4-AA0925DB8997@acm.org> <83img48ffx.fsf@gnu.org> <5AEB442C-5592-46E4-BC38-185BA9D2D956@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="123961"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41544@debbugs.gnu.org To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 07 18:04:38 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhxmo-000W7P-AX for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Jun 2020 18:04:38 +0200 Original-Received: from localhost ([::1]:45424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jhxmn-00077m-DE for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Jun 2020 12:04:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jhxjK-0003Jo-C4 for bug-gnu-emacs@gnu.org; Sun, 07 Jun 2020 12:01:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43185) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jhxjK-0006dR-1m for bug-gnu-emacs@gnu.org; Sun, 07 Jun 2020 12:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jhxjJ-0000UI-W9 for bug-gnu-emacs@gnu.org; Sun, 07 Jun 2020 12:01:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Jun 2020 16:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41544 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 41544-submit@debbugs.gnu.org id=B41544.15915456501202 (code B ref 41544); Sun, 07 Jun 2020 16:01:01 +0000 Original-Received: (at 41544) by debbugs.gnu.org; 7 Jun 2020 16:00:50 +0000 Original-Received: from localhost ([127.0.0.1]:54731 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhxj8-0000Iy-Aq for submit@debbugs.gnu.org; Sun, 07 Jun 2020 12:00:50 -0400 Original-Received: from userp2120.oracle.com ([156.151.31.85]:57990) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhxj7-0000CS-3o for 41544@debbugs.gnu.org; Sun, 07 Jun 2020 12:00:49 -0400 Original-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== Original-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 Original-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 Original-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 Original-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 In-Reply-To: <5AEB442C-5592-46E4-BC38-185BA9D2D956@acm.org> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.5005.0 (x86)] 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181677 Archived-At: > > +(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.