bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#41544: 26.3; Possible incorrect results from color-distance


From: Mattias Engdegård
Subject: bug#41544: 26.3; Possible incorrect results from color-distance
Date: Sun, 7 Jun 2020 11:13:01 +0200

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

> +(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.
> 
> 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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]