-
Notifications
You must be signed in to change notification settings - Fork 1
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
HSL Support? ✖ color2.luminance is not a function #2
Comments
Hi @frankstallone , I cannot reproduce this issue. Can you please post the whole palette file? I would assume that it's either the I only get the issue when one of the colors is invalid (like "foo"). I should at least improve the error message here, so the affected color value is being displayed. |
Okay so I added my EDIT while you replied. I saw your post come up as I was submitting. Yeah this palette was made before reading there was a specific step requirement. I think this is related to your other post. I removed the |
While the 100 steps definitely won't work (as in: the tool will not be able to compute the values), I don't think this is the reason for your error message. This message can only happen if a color value is in fact not valid. RGB, HSV, HSL, and CMYK are supported, so there must be some error somewhere in your palette. For example, this one doesn't throw any error:
I will improve the tool to output all invalid colors. |
Thanks for this hint, I will also trim the color values to prevent such issues in the future.
Yes, that's the reason. And yes, you can just remove a 0 from every color, and it should work. Even your 110 and 120 values should work fine in theory. And your results confirm this. What you get are the magic numbers 70, 80 and 90. Because those values are so high for your color palette, they might be not that useful for a generic use. If you're targetting WCAG AA (contrast ratio >= 4.5), every difference of In summary, it doesn't matter whether you're using It also doesn't mean that your color palette is "bad" or "inaccessible" - it just means that the magic number approach doesn't work as well as it does for other palettes. |
Very interesting, and thank you for elaborating on this. You helped me understand the elements that did not click for me from reading your article. Ultimately, this tool was the best I could find so far, or closest to what I am looking for. I want something that can look at all the colors in our palette (82) and put together recommendation pairings for each color combination and it's lighter version for text, in alignment with WCAG recommendations. I might find a better way to phrase that, but I think I had in the past seen a tool that does this. Then I can put a demo together in our design system which is created in a Storybook. If you know of such a tool let me know. Thanks again for creating this one! |
Yes, it's a rather complex topic and it was difficult for me to explain it. I would be happy to improve my blog post if you could point out the places which you've found confusing.
You mean you would like to pass a color palette and get all valid color combinations for a given contrast ratio? I think colorable should be able to solve this issue. While |
If I can come up with a clearer way of articulating what you've done here I'll let you know. However, I feel as though the topic is just heavy. There is a lot to know, and a lot to consider.
Yes, exactly. colorable looks like it creates palettes, but I will give it a try. 82 colors is enough for right now, I don't need more hah! That's great if you think it would be a worthy addition to your project. leonardo has a feature that add bulk key colors but from my limited understanding that, too, seems to create color palettes from your keys, instead of comparing. I have learned a lot over the past few days and really do appreciate your time and patience. |
Does this support HSL? I created a
.json
file of our SASS variable and runningnpx a11y-contrast color-palette-3.3.json
produces the following:Example of the file:
EDIT: Maybe this is because these color name don't conform to the grades
0
-100
?The text was updated successfully, but these errors were encountered: