Repository navigation
Replies: 1 comment 5 replies
|
I don't think it would make a lot of sense to be built-in, as there are a lot of various ways to represent colours (hex, rgb{a}, hsl, oklch etc), this would bloat the bundle quickly. Those could be good candidates for Registry items though, as they are likely to be tweaked by users to suit their exact needs. Feel free to open a PR towards this if you're interested. |
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I was looking for a way to parse an rgb triplet hex color state variable, hence I dug into the (great, by the way!) doc.
Saw the parseAsHex doc which points to the hex-colors playground.
Given colors are one of the basic variable types, do you think it could make sense to make
parseAsColora built-in parser like parseAsstring, numbers (ints, floats, hex, index), boolean, literals, enums, dateetc?Similar to specifying the possible values for Literals constructor, it could make sense to specify the desired state output type, eg among
hex, struct, and could support both rgb/rgba with alpha, prefixed with hash or not, as well as 3/6 characters colors like#fff vs #ffffffAll reactions