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

[css3-color] clipping of hsl() color values to device gamut

From: L. David Baron <dbaron@dbaron.org>
Date: Mon, 24 Mar 2008 18:57:36 -0700
To: www-style@w3.org
Message-ID: <20080325015736.GA12115@ridley.dbaron.org>

I realized since I sent the previous message that issue 4 in
http://csswg.inkedblade.net/spec/css3-color is more complicated than
it seemed to me at first.  The question is how saturation and
luminance values for hsl() should be handled when they are outside
of [0%, 100%].

The spec has existing text for clipping of rgb() colors to the
device gamut that implies (although doesn't explicitly require) that
it should be done by clipping the red, green, and blue components
separately.  (This actually seems like it's not ideal.)  In fact, I
think clipping them separately up to the extent of the device gamut
is only even well-defined if the device works in terms of red,
green, and blue components, which I think is often not the case.

Given my limited knowledge of colors, I'd propose the following text
for the spec:

 # If saturation is less than 0%, it must be clipped to 0%.  After
 # that, values outside the device gamut must be clipped to the
 # device gamut.  This clipping should preserve the hue when
 # possible, but is otherwise undefined.

However, I'd be open to a better definition, as long as it's
compatible with clipping both saturation and luminance values to
[0%, 100%] when the device gamut is (or is assumed to be) sRGB,
which seems to be what existing browser implementations (Gecko,
WebKit) do on http://dbaron.org/css/test/2008/hsl-clipping (each
pair of tests matches, none are red).


L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Tuesday, 25 March 2008 01:58:12 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:35 UTC