-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
The Alpha channel cannot be change between different themes #117
Comments
Hiya! Thanks for opening the issue. Let me look into it. |
This is a legitimate issue and here is a reproduction example https://codesandbox.io/p/devbox/117-repro-7yqchp My wife says I've been working too much today, so I'll start looking into potential solutions later, but for your amusement, here was my "maintainers' 5 stages of grief" in response to seeing this issue.
|
This hasn't left my mind! The fix for this will be tricky and I'm currently evaluating options. |
I have a proof of concept made using an approach that parameterizes the alpha value using css vars. This won't support the old opacity approach (e.g. classes like For example a class like :root {
--colors-primary: ...
}
.darkTheme {
--colors-primary: ...
}
.bg-primary {
background-color: rgb(var(--colors-primary) / 0.5); /* 0.5 hardcoded because of this bug */
} ...would now output a class like... :root {
--colors-primary: ...
--colors-primary-alpha: ...
}
.darkTheme {
--colors-primary: ...
--colors-primary-alpha: ...
}
.bg-primary {
background-color: rgb(var(--colors-primary) / var(--colors-primary-alpha));
} Reference discussion for background on alpha support: #95 |
I haven't forgotten about this. I plan on working on it soon. |
Hi @RyanClementsHax, first of all thank you for your great work! I have to ask if we can expect a solution to this problem here? If not, we will have to consider discontinuing the use of your near-perfect library. We would really appreciate a positive response :) |
Hi @RyanClementsHax, We've been encountering the same issue, not only with opacity but also with the theme function. To help illustrate the problem, I created this CodeSandbox. When we define a color with opacity at default extend theme (using A similar issue occurs with the If you have any insights on why this happens and whether the issue could be split into smaller tasks, I'd be happy to assist. Thanks for your awesome work! Here's the sandbox for reference: https://codesandbox.io/p/github/Matozinho/tailwindcss-themer-example/main |
Hey @Franjoo, I found a way to replace the plugin, by using this approach. This solution is close to how we used the plugin, so it was easy to replace and very functional. I hope it helps you too. |
Describe the bug
When i set a token like this, at Light Theme:
backgroundHover: 'rgba(0,0,0,0.9)',
and switch change it in Dark Theme:
backgroundHover: 'rgba(255,255,255,0.5)',
The color does change, but the alpha channel stuck at 0.9 between themes
Your minimal, reproducible example
none
Steps to reproduce
None
Expected behavior
The alpha change actually change base on theme
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
window
tailwindcss-themer version
4.0.0
Additional context
No response
The text was updated successfully, but these errors were encountered: