Skip to content
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 values with opacity break #74

Closed
silveltman opened this issue May 13, 2023 · 6 comments · Fixed by #111
Closed

HSL values with opacity break #74

silveltman opened this issue May 13, 2023 · 6 comments · Fixed by #111

Comments

@silveltman
Copy link

Describe the bug

I use this plugin with radix color palette (check #67).
All regular colors work fine, but all 'A' colors do not. Like, gray works, but grayA breaks.

I believe the difference between those 2 colors palettes is one uses different shades, the other (A) uses opacity.

I'm not 100% sure though, since radix's documentation doesn't explain this.

Your minimal, reproducible example

https://play.tailwindcss.com/LeVSicAa9O?file=config

Steps to reproduce

open tailwindplay

Expected behavior

Expect it to work with opacity

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

mac, brave

tailwindcss-themer version

3.0.2

Additional context

No response

@RyanClementsHax
Copy link
Owner

Hiya! Thanks for opening this. Also thanks for making the reproduction repo. I'm looking into this now.

@RyanClementsHax
Copy link
Owner

Ah, I see what's going on. The alpha value is stripped. This is intentional. These docs explain more, but the TLDR is that manually specifying alpha runs into problems when you also want to use tailwind's opacity classes.

If I'm being honest, when implementing this feature, I didn't think many people worked with color palettes that baked opacity into them.

Alas, if I could wave a magic wand, I'd probably make it so that the default opacity is configurable as this is a situation I think would be reasonable to support, but the api to configure this on a per value basis isn't available in tailwind from what I know. Tailwind wants to manage opacity itself.

That being said I'm open to discussion if you want to consider this point further. For now, I'll close this issue.

@RyanClementsHax
Copy link
Owner

I've opened up #95 and would love to hear from you @silveltman !

RyanClementsHax added a commit that referenced this issue Nov 19, 2023
resolves #95
fixes #74
fixes #77

BREAKING CHANGE: Alpha channels in colors are no longer stripped. If you want the alpha channels stripped still, either do so manually or change the classes you are using to use the [opacity modifier syntax](https://tailwindcss.com/docs/upgrade-guide#new-opacity-modifier-syntax) with the opacity set to `100` e.g. from `bg-primary` to `bg-primary/100`.
RyanClementsHax added a commit that referenced this issue Nov 19, 2023
resolves #95
fixes #74
fixes #77

BREAKING CHANGE: Alpha channels in colors are no longer stripped. If you want the alpha channels stripped still, either do so manually or change the classes you are using to use the [opacity modifier syntax](https://tailwindcss.com/docs/upgrade-guide#new-opacity-modifier-syntax) with the opacity set to `100` e.g. from `bg-primary` to `bg-primary/100`.
Copy link

🎉 This issue has been resolved in version 4.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@RyanClementsHax
Copy link
Owner

I just released this feature in v4. @silveltman let me know if this addresses your issue.

https://www.npmjs.com/package/tailwindcss-themer

@silveltman
Copy link
Author

@RyanClementsHax I'm currently trying out UnoCSS, but will try if/when switching back to tailwind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants