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

Previous Next

Package: emacs;

Reported by: Simon Pugnet <simon <at> polaris64.net>

Date: Tue, 26 May 2020 16:34:01 UTC

Severity: normal

Tags: patch

Found in version 26.3

Full log


Message #103 received at 41544 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Mattias EngdegÄrd <mattiase <at> acm.org>, Eli
 Zaretskii <eliz <at> gnu.org>
Cc: 41544 <at> debbugs.gnu.org
Subject: RE: bug#41544: 26.3; Possible incorrect results from color-distance
Date: Sat, 6 Jun 2020 11:15:57 -0700 (PDT)
(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.




This bug report was last modified 4 years and 304 days ago.

Previous Next


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