Skip to content

Possible issue with color::from_hsl #594

Answered by ashbob999
ErrorFlynn asked this question in Q&A
Discussion options

You must be logged in to vote

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) produces r=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.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ErrorFlynn
Comment options

Answer selected by ErrorFlynn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants