Closed r0nsha closed 1 year ago
Did you check that hue
continues to work? I think you will need to expand it to contain the alpha variants.
Oh yeah I'll add the alpha variants to hue
too.
Also I tried using the hue
feature and I found that hue12
didn't work for me. It was caused because the hue indices were 0-based (since it was an array). I switched it to a mapped object instead like all of the other scales. It works for me now.
The last commit made it so you can do something like hue-redA
or hue-brandA
for aliases too.
I would prefer if it was like: hue-red
& bg-hueA12
, you should be able to just add another set of aliases into the template literal in the hue block.
The idea of hue
is so you can have things like buttons, cards, etc with many colors without a lot of string substitution in component code, you can just safelist the hues you use everywhere and you can then safely use hue-${hue}
for example.
Other than that, this looks really good, thanks for contributing!
That makes more sense, I'll do it when I have time this week
@endigma Done.
There's one issue. Since unocss parses color classes using kebab-case, the class bg-hueA12
doesn't work. Here's a related issue: https://github.com/unocss/unocss/issues/1894.
These work though: bg-hueA-12
and bg-hue-a-12
What do you think? I couldn't find a way to do this. I also tried using hueA1
...12
as keys instead of nesting hueA: { 1...12 }
but it didn't work.
The scuffed way is fine, if you're feeling fancy just add it in the readme. I'll merge this either way.
I'm not sure what to write in the README, maybe you could explain it better?
Thank you for accepting the PR! Are you planning on publishing the change to npm? I'd like to switch back from my fork
I will after I work out some other changes.
@r0nsha this is in as of 2.4.0, albeit with a slightly different API than you had. It's now like bg-blue12A
not bg-blue-a-12
, they are treated as extra shades not extra scales.
That's a neat solution
As mentioned in #8, this PR makes it so alpha variants of the chosen palette are generated automatically for you, and also adds the overlay colors
blackA
andwhiteA
. Alpha variants are also added for aliases, so for a given aliasbrand: blue
, the aliasbrandA: blueA
will also be generated.