W3C home > Mailing lists > Public > public-css-archive@w3.org > September 2016

[csswg-drafts] [css-color] hsl values - integer or number?

From: MSP-Greg via GitHub <sysbot+gh@w3.org>
Date: Tue, 20 Sep 2016 20:43:50 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-178175131-1474404227-sysbot+gh@w3.org>
MSP-Greg has just created a new issue for 
https://github.com/w3c/csswg-drafts:

== [css-color] hsl values - integer or number? ==
I believe the current wd does a good job of explaining hsl vs rgb.  
See [6. HSL Colors: hsl() and hsla() 
functions](https://www.w3.org/TR/css-color-4/#the-hsl-notation), and 
the following section (6.1) on conversion.

What it does not address is how an algorithm for hsl to rgb conversion
 should handle numbers, as opposed to 'integer' values.  I believe the
 spec refers to hsl using 'numbers', and numbers are not restricted to
 being integers, see [CSS Values and Units Module Level 3 - 4.2 Real 
Numbers: the <number> 
type](https://www.w3.org/TR/css3-values/#numbers).

I checked four browsers for conversion from hsl to rgb (using s = 
100%, l = 50%).  In this restricted 'color space', rgb (1,530) has 
4.25 times the resolution of hsl (360) when hsl is computed using 
integer values.

So I checked the browsers using a hue (h) value that varied from 0 to 
6.9 by tenths.

I found three different algorithms being used, three displayed only a 
green value that was a 'rounded multiple' of 4.25 (0, 4, 8, 12, 17, 
21, 25).  Of the three, two truncated, one rounded. Only one browser 
had all green integer values.

See https://msp-greg.github.io/ct-hue-sat.html for the test I used.

I did check that the painted rgb color matched the reported color.

Given that monitor technology has changed quite a bit since hsl was 
introduced in 2003 or so, I think it would be helpful for hsl to have 
the same color range as rgb.  Hence, can the spec reflect that?

Thanks for your work...

Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/506 using your GitHub 
account
Received on Tuesday, 20 September 2016 20:43:58 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:03 UTC