Incorect css order for custom color + dark mode + bg-opacity
See original GitHub issueMinimal demo: https://github.com/xorik/vite-dark-bg-opacity
Hi. Custom color + bg opacity works fine for normal mode, but CSS order seems incorrect for dark mode.
Expected (added !important
to all opacity classes):
Actual:
Devtool screenshot:
HTML:
<div class="flex h-20 my-10 justify-between">
<div class="bg-primary flex-1"></div>
<div class="bg-primary flex-1 bg-opacity-70"></div>
<div class="bg-primary flex-1 bg-opacity-50"></div>
<div class="bg-primary flex-1 bg-opacity-20"></div>
</div>
<div class="dark bg-dark-400 py-10">
<div class="flex h-20 my-10 justify-between">
<div class="dark:bg-primary flex-1"></div>
<div class="dark:bg-primary flex-1 bg-opacity-70"></div>
<div class="dark:bg-primary flex-1 bg-opacity-50"></div>
<div class="dark:bg-primary flex-1 bg-opacity-20"></div>
</div>
</div>
Config:
{
purge: [],
darkMode: 'class', // or 'media' or 'class'
theme: {
extend: {
backgroundColor: {
primary: ({ opacityValue }) => {
if (opacityValue !== undefined) {
return `rgba(30, 58, 138, ${opacityValue})`;
}
return `rgb(30, 58, 138)`;
}
}
},
},
variants: {},
plugins: [],
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Dark Mode in CSS
“Dark mode” is defined as a color scheme that uses light-colored text and other UI elements on a dark-colored background. Dark mode, dark...
Read more >dark variant not respecting bg-opacity #2966 - GitHub
Describe the problem: I have darkMode: 'class' in my config. ... is only applied in light mode, but in dark mode bg-opacity is...
Read more >How do I apply opacity to a CSS color variable? - Stack Overflow
I solved this issue now, by applying the background-color and the opacity to a pseudo :after or ... If you use dark and...
Read more >prefers-color-scheme - CSS: Cascading Style Sheets | MDN
Indicates that user has notified that they prefer an interface that has a light theme, or has not expressed an active preference. dark....
Read more >How to Set Opacity of Images, Text & More in CSS
Below, I'll set a paragraph to be slightly transparent against a dark solid background color. HTML; CSS. Result; Skip Results Iframe.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
today or tomorrow.
actually we have a new feature from next version can solve this better.
https://github.com/windicss/windicss/blob/31c270185811d1864072ee23944b92bc8e753ece/test/processor/__snapshots__/utilities.test.ts.yml#L130-L133