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

transparent displaying as black (0, 0, 0) #77

Closed
troymcginnis opened this issue May 23, 2023 · 9 comments · Fixed by #111
Closed

transparent displaying as black (0, 0, 0) #77

troymcginnis opened this issue May 23, 2023 · 9 comments · Fixed by #111

Comments

@troymcginnis
Copy link

troymcginnis commented May 23, 2023

Describe the bug

When setting a color token with a value of transparent, the CSS variable is set to 0, 0, 0 with a default of --tw-bg-opacity: 1. This causes the output color to be black.

My assumption is that this has something to do with the way that Themer removes alpha channels from colors to support the opacity modifier syntax, though I'm not sure how to overcome this without using an arbitrary value such as bg-[transparent]. This may work in some cases but my preference would be to stick with the default TW setup of bg-transparent.

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/magical-swartz-t09moi?file=%2Fpackage.json%3A16%2C29-17%2C35

Steps to reproduce

  1. Hover over the first two buttons (note black background)
  2. Hover over last button (note transparent background using hover:bg-[transparent]

Expected behavior

The expected behaviour is that the top two buttons will have transparent backgrounds since using the transparent color keyword.

How often does this bug happen?

Every time

Screenshots or Videos

Screenshot 2023-05-24 at 9 47 49 AM

Platform

  • macOS Ventura 13.0 (22A380)
  • Google Chrome
  • Version 113.0.5672.126

tailwindcss-themer version

v3.1.0

Additional context

No response

@troymcginnis troymcginnis changed the title transparent displaying as black (0, 0, 0,) transparent displaying as black (0, 0, 0) Jun 23, 2023
@github-actions
Copy link

This issue has been automatically marked stale because it it received no activity for 60 days. If you wish to keep this open, please leave a comment. Thanks.

@github-actions github-actions bot added the Stale label Aug 23, 2023
@troymcginnis
Copy link
Author

Bump

@github-actions github-actions bot removed the Stale label Aug 24, 2023
@RyanClementsHax
Copy link
Owner

Thanks for opening this! I'll be sure to take a look at it soon

@troymcginnis
Copy link
Author

Thanks for opening this! I'll be sure to take a look at it soon

Thanks!

@RyanClementsHax
Copy link
Owner

This is similar to #74 in that users of tailwindcss-themer want to use colors with alpha values. I do think good use cases are presented, but tailwind wants to manage opacity itself.

In the interest of supporting the community use cases I'll consolidate this into #95 where this can be further discussed. I'd love to get your thoughts @troymcginnis :)

I'll close this for now as this is expected behavior.

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. @troymcginnis let me know if this addresses your issue.

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

@troymcginnis
Copy link
Author

@RyanClementsHax Upgraded and looks to be working as expected! Thanks so much for implementing the change 🙏🏼

@RyanClementsHax
Copy link
Owner

No problem! Happy to help.

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