W3C home > Mailing lists > Public > www-style@w3.org > September 2008

Re: Color Lightening and Darkening

From: David Woolley <forums@david-woolley.me.uk>
Date: Mon, 01 Sep 2008 22:22:45 +0100
Message-ID: <48BC5D25.2080502@david-woolley.me.uk>
To: www-style@w3.org

Mikko Rantalainen wrote:
> suggest that if relative colors are introduced, then an another property
> "min-foreground-background-absolute-difference" (a shorter name would be
> nice) should be added, too. The behavior for that property would be to
> specify minimum value for function
> 
> 	abs(r1-r2) + abs(g1-g2) + abs(b1-b2)
> 
> where abs() returns absolute value and r1 is red color component value

If you are going to do this, you should use the same algorithm as used 
in W3C's web accessibility guidelines.  That may not be the current 
algorithm, as I have some reservations about whether it really reflects 
the behaviour of they eye.

That is basically convert to total power flux with different weights for 
red, green, and blue, then impose a minimum ratio between the two 
values, offset by constants.  Total power is got by undoing the sRGB 
correction, then adding together with weights which, I suspect, are the 
luminance weights, used to get the Y signal in colour TV.  The ratio 
part could be described by saying that you take a function that is 
asymptotic to a logarithm, for large values, and asymptotic to a 
constant for small values, and requiring a certain absolute difference.

-- 
David Woolley
Emails are not formal business letters, whatever businesses may want.
RFC1855 says there should be an address here, but, in a world of spam,
that is no longer good advice, as archive address hiding may not work.
Received on Monday, 1 September 2008 21:23:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:12 GMT