Re: How To Compare Colors?

Tech-Archive recommends: Fix windows errors by optimizing your registry



"cppaddict" <hello@xxxxxxxxx> wrote in message
news:1o8a919porad17fbkf7tk7pv9sanp0rk1g@xxxxxxxxxx
>I realized that a perhaps clearer explanation of what I want is:
>
> 1. First convert the 2 colors to greyscale.
> 2. Now compare how black they are.

Compute the luminosity of both colors (i.e. get a 'brightness' value from
0.0..1.0), then compare the two values.

There are different standards for the luminosity calculation. It is really
up to you which one to use:

Y = 0.299*Red + 0.587*Green + 0.114*Blue (most commonly used)
Y = 0.213*Red + 0.715*Green + 0.072*Blue
Y = 0.222*Red + 0.707*Green + 0.071*Blue (latest ITU recommendation)
( all from http://lists.gnu.org/archive/html/groff/2001-10/msg00181.html )

--

Jason Doucette
http://www.jasondoucette.com/
http://www.sawtoothdistortion.com/


.