Closed davidek-dev closed 11 months ago
Thank you @davidek-dev
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.
in the following i have a Recording of my steps using the windows buildIn Steprecording tool: stepRecording.zip
I see. Here's what's happening: You have dark + light themes in your config so at this point, the website adapts the OS settings. It will be dark on dark mode, it will be light on light mode.
And now you have a checkbox which can only be checked/unchecked. If it's not checked, nothing happens and the page will have system theme as I described above. If it's checked, it will apply dark
theme.
Here's the problem. If the system is dark, you see dark theme on the page and then you check the checkbox to activate dark
theme… so it's just dark/dark…
So, it's not logically possible to have 3 options (system, light, dark) using a binary checkbox that can be true or false.
Let me know if you have a question.
I'm sorry if I explained it confusingly. Your exactly right, i only want 2 option but with the implementation like on the official DaisyUI Site you have 3 for an binary switch, witch is wrong in my opinion. I think there should be either an option for or the standard behaviour to check/uncheck automatically the checkbox whenever the user changes its system mode settings
so the user experience would be like:
i hope you understand what i mean, i'm not that fluent in english and struggle explaining what i mean
As far as I know the scenario you described would need JS on runtime to dynamically change the checkbox value based on OS preference. Because the value of the HTML checkbox is not something we can control from tailwind.config.js
at build time.
What version of daisyUI are you using?
No response
Which browsers are you seeing the problem on?
Edge
Reproduction URL
https://daisyui.com/components/theme-controller/
Describe your issue
This Problem occurs, when you use the Theme Controller toggle as a controller for changing between dark & light mode. DaisyUI provides excelent support for defining a custom dark mode that is used automatically, whenever the user system is in dark mode. After the page automatically recognizes the user switching from light to dark, the theme is correctly changed into darkmode. unfortunetly the Theme Controller doesn't switch the theme to light mode anymore. I linked the official docs because this behaviour can be seen aswell on the official Docs website. In contrast to my personal implementation, the DaisyUI Docs Site seems to have a standard dark mode aswell as a custom one in the theme settings. That is why, the toggle on the DaisyUI Docs Site still does work. But like in my personal project, it does not change it to the original lightmode like what it did when the system was still in lightmode, instead the Theme Controller now switches between the custom nightmode theme and the standard nightmode theme. If this is a feature and not a bug, it definetly should be put into consideration that most likely people do not want this change to happen in night mode but instead want the standard behaviour (a toggle between light and night and not a toggle between custom night and standard night).
this is my tailwind.config.js:
and this is my personal implementation of the Theme Controller (i'm using this in an astro project):