-
Notifications
You must be signed in to change notification settings - Fork 715
[css-color-3] HSL examples show incorrect RGB values #3088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
How very odd, especially as the tables are supposed to be direct from the program. You are correct about the hsl(0, 100%, 88%) testcase which should indeed give #FFC2C2 Thanks for the bug report, will check further and issue an erratum. Meanwhile the algorithm is authoritative over the example tables (which should still be corrected). |
An additional issue is that the original table has lightness values which are rounded off. For example 13% is presumably 12.5% rounded to integer? |
The table in CSS Color 4 has now been replaced with a generated table which is correct. See workings/hsl-tables-for-color-3-errata/ to regenerate the table |
The same table has been added to CSS Color 3 as a Candidate Correction. |
Section 4.2.4. HSL color values provides an algorithm for translating HSL to RGB, and states that the tables in section 4.2.4.1. HSL examples are generated using this algorithm.
However, the RGB values in the example tables do not match the output of the algorithm.
For example, in the "0° Reds" example table, Saturation=100% and Lightness=88 is shown to have the RGB value
#FFBFBF
.However, running the following ABC program (the algorithm from the spec plus the additional line
WRITE hsl.to.rgb(0/360, 1.00, 0.88)
produces the output(1.00, 0.76, 0.76)
, which converts to the [0,255] range as(255.0, 193.8, 193.8)
, which is the hex RGB value#FFC2C2
(if rounded) (or#FFC1C1
, if floored).ABC program
Of the 540 examples, 251 of them appear not to match the reference algorithm.
I'm assuming the given algorithm is meant to be considered authoritative and the example tables are not--is that a correct assumption?
If so, can the example tables be fixed to have correct RGB values? Or alternatively, at least add a note that the example tables only provide "close" and not accurate values for the purposes of illustration?
The text was updated successfully, but these errors were encountered: