Closed joachimesque closed 2 years ago
Hi! Unfortunately, there are no options to do that at the moment and I doubt we are going to add something like that since the library aims to be super small and support the most popular scenarios only.
Thank you for your answer! In the end I could hack it together, here are the links in case someone's got the same use case as mine: https://kitten-git-color-selector-add-component-kisskissbankbank.vercel.app/?path=/story/form-colorselect--default
It's using two external libs (one for checking the color contrast, and one that's only providing Hex <-> HSV conversion, which I could do without): https://github.com/KissKissBankBank/kitten/pull/2961/files#diff-6623f6cc65d1955168b649467b3c395f546383b91280ef962a83db016a192dcd
Wow! Looks nice, great job!
P.S. You can also replace color-convert
and wcag-color
with my colord
package to convert colors and calculate a11y values: https://colord.omgovich.ru/
Thank you, that should be simpler to use!
Edit: The switch to colord
was easy!
A small update, the component now lives in our design system, here: https://kitten.vercel.app/?path=/docs/form-colorselect--default
Hi!
Your library looks like the perfect candidate for a project I'm building. I'd love to know if it's feasible to restrict the color selector to colors with a minimal contrast with a given base color. For example, I want the color selection to be restricted to colors with a 1:4.5 contrast against white, and colors below that threshold to be impossible to select. A bit like that: