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

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).

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Tuesday, 25 March 2008 01:58:12 UTC