You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Strangely, <html data-theme="dark"> still works when there's prefersdark: true;.
I checked the generated CSS and found that prefers-color-scheme: dark is after [data-theme="light"]. This makes it impossible for [data-theme="light"] to override prefers-color-scheme: dark.
data-theme="dark" still works because it's after prefers-color-scheme: dark, therefore able to override prefers-color-scheme: dark.
Thank you @lts20050703
for reporting issues. It helps daisyUI a lot 💚
I'll be working on issues one by one. I will help with this one as soon as a I
find a solution.
In the meantime providing more details and reproduction links would be
helpful.
For anyone who got here, just want to say that swapping themes: dark, light to themes: light, dark isn't enough, you also have to move the dark style above the light style, something like this :)
What version of daisyUI are you using?
5.0.0-alpha.29
Which browsers are you seeing the problem on?
All browsers
Reproduction URL
https://play.tailwindcss.com/pFadUDJMTg
Describe your issue
<html data-theme="light">
doesn't work when there'sprefersdark: true;
app.css
Strangely,
<html data-theme="dark">
still works when there'sprefersdark: true;
.I checked the generated CSS and found that
prefers-color-scheme: dark
is after[data-theme="light"]
. This makes it impossible for[data-theme="light"]
to overrideprefers-color-scheme: dark
.data-theme="dark"
still works because it's afterprefers-color-scheme: dark
, therefore able to overrideprefers-color-scheme: dark
.TL;DR: Current generated CSS order:
Fixing this should be a simple reorder to
In other words,
daisyui/src/theming/functions.js
Line 214 in dfec9ea
prefers-color-scheme: dark
before injecting the root theme.The text was updated successfully, but these errors were encountered: