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

Re: [css3-transitions] colour space used for colour interpolations

From: Rik Cabanier <cabanier@gmail.com>
Date: Sat, 26 May 2012 22:39:04 +0300
Message-ID: <CAGN7qDA6jeXFuHwO3PEcN4tu6HsE+P1Ky4dSHh3Evv7ES2Kg+A@mail.gmail.com>
To: Brad Kemper <brad.kemper@gmail.com>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Cameron McCormack <cam@mcc.id.au>, "www-style@w3.org" <www-style@w3.org>
On Sat, May 26, 2012 at 9:52 PM, Brad Kemper <brad.kemper@gmail.com> wrote:

> On May 24, 2012, at 1:47 PM, "Tab Atkins Jr." <jackalmage@gmail.com>
> wrote:
> > On Thu, May 24, 2012 at 9:44 AM, Rik Cabanier <cabanier@gmail.com>
> wrote:
> >> Reading a bit more on the wikipedia article [1] on HSL, I came across
> the
> >> following quote:
> >>
> >> Because hue is a circular quantity, represented numerically with a
> >> discontinuity at 360, it is difficult to use in statistical
> computations or
> >> quantitative comparisons: analysis requires the use of circular
> statistics.
> >> Furthermore, hue is defined piecewise, in 60 chunks, where the
> relationship
> >> of lightness, value, and chroma to R, G, and B depends on the hue chunk
> in
> >> question. This definition introduces discontinuities, corners which can
> >> plainly be seen in horizontal slices of HSL or HSV.
> >>
> >> I believe it doesn't make sense to transition in HSL because of these
> issue.
> >> Who would want to create such a synthetic transition?
> >
> > Heh, who would ever want to transition in RGB?  It's infinitely worse.
> ^_^
> >
> > Ultimately, what matters is what the system graphics libraries
> > support, or can be extended to support.  HSL is a pretty shitty
> > colorspace, but it's simple to work with, and way better than RGB for
> > most things.  If we can convince the implementors working on graphics
> > to do a better colorspace, awesome, but if we can't, falling back to
> > HSL is acceptable in my mind.
> >
> > (The major problem with HSL, more than anything else, is that there's
> > no analog of "premultiplied" colors like RGBA has, so transitions
> > to/from 'transparent' are going to be ugly.  I don't think any of the
> > better colorspaces have a solution to this either.)
> When I am creating gradients from some color to transparent, I usually end
> up using rgba for the transparent side, so that I can set the rgb part of
> that to match the full color version. That seems to usually work well
> enough to render decently in UAs that don't pre-multiply. So, I would think
> that with hsla, it would be no worse than that. HSL is useful when you just
> want to adjust lightness and/or saturation, which I'd guess would be the
> most common gradient or transition changes, not including alpha changes, by
> far. In my experience, using gradients or transitions to a lighter or
> darker version of the same hue is much more common than rotating through
> different hues.

It seems that you would want to use Lab in that case, although it would be
hard/impossible to do a complete color match with your sRGB values.

Received on Saturday, 26 May 2012 19:39:34 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:16 UTC