Possible issue with color::from_hsl #594
-
The method The reason I said "possible issue", is because I wrote my own conversion function, and it produces the same results as
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
After doing some searching and implementing the same algorithm from different websites, i have gotten the exact same value each time for There does not seem to be a problem with the algorithm but I think the problem lies in the colour picker websites (partially explained here) Example |
Beta Was this translation helpful? Give feedback.
After doing some searching and implementing the same algorithm from different websites, i have gotten the exact same value each time for
hsl(210, 0.68, 0.80)
producesr=169, g=204, b=239
(#A9CCEF
). From this website: https://convertacolor.com/.There does not seem to be a problem with the algorithm but I think the problem lies in the colour picker websites (partially explained here)
Example
#ABCDEF
->hsl(210, 68%, 80.4%)
they round 80.4% to 80%So we get
hsl(210, 0.68, 0.80)
-> '#A9CCEF'So if the websites round the
saturation/lightness
to an integer (if percentage) or 2 decimal places (if double), they will then be giving incorrect conversion values.