W3C home > Mailing lists > Public > www-style@w3.org > January 2012

Re: [css3-images] We should use linear RGB color space when doing gradients (and transitions, and ...)

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Sat, 14 Jan 2012 16:36:51 -0800
Message-ID: <CAAWBYDC9-v6-B07iJdB5=jR7e5zjfvzcgWrocFyWSyiZwtQH2g@mail.gmail.com>
To: Witold Baryluk <baryluk@smp.if.uj.edu.pl>
Cc: "www-style@w3.org" <www-style@w3.org>
On Sat, Jan 14, 2012 at 8:55 AM, Witold Baryluk
<baryluk@smp.if.uj.edu.pl> wrote:
> On 01-13 23:27, Tab Atkins Jr. wrote:
>> Since everything currently uses sRGB, gradients should match that and
>> stay how they are.
>
> I disagree. As you said, everything is sRGB, but doing linear gradients
> in way they are currently done, are incorrect usage of sRGB. sRGB is
> only usefull for transfering pixels colors, not performing ANY
> operations on them other than displaying on devices using same color
> space. Any operation like resampling, rescaling, generating gradients,
> performing blending, performing any kind interpolation based on
> position, time, or other parameters must be done in linear space to
> produce correct sRGB result.
>
> This just means that CSS is not using sRGB, but mix of sRGB and RGB,
> often interchanging them without doing proper conversion.

I agree that it's wrong.  However, it's better for everything to be
wrong in a consistent way (which can be fixed later) than for things
to be inconsistent, with some things working correctly and others
incorrectly.

SVG *already has* a way to fix this, via the 'color-interpolation'
property: <http://www.w3.org/TR/SVG/painting.html#ColorInterpolationProperties>.
 SVG gradients pay attention to it, and it defaults to sRGB.  At some
point we should pull it into general CSS so that it applies to CSS
gradients as well

I won't be making this change - CSS gradients should be consistent
with SVG gradients, CSS Transitions/Animations (and, I suspect, SVG
animations as well, though I haven't tested it), and other things.
SVG has a way to indicate that all of its things should use linearRGB
instead, and CSS should adopt that in the future, but I don't want to
add it to Image Values level 3.  It should be considered for either
Image Values 4 or Colors 4.

Please indicate whether or not this resolution is acceptable.

~TJ
Received on Sunday, 15 January 2012 00:38:08 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:48 GMT