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

bug: Toggling dark mode manually #2754

Closed
PunkFleet opened this issue Jan 14, 2024 · 2 comments
Closed

bug: Toggling dark mode manually #2754

PunkFleet opened this issue Jan 14, 2024 · 2 comments

Comments

@PunkFleet
Copy link

What version of daisyUI are you using?

v4.6.0

Which browsers are you seeing the problem on?

All browsers

Reproduction URL

none

Describe your issue

The component does not support the manual switching mode of tailwindcss.
When switching dark mode manually, if there is a conflict between the system preferences and the manual settings, the manual settings are disabled. For example, if the system preference is dark and light is switched manually, the component style fails.
tailwindcss.config.js

...
darkMode: ['class', '[data-theme="dark"]'],
...

index.html

<html data-theme='light'>
<div class="stats shadow bg-base-200 dark:bg-slate-700">
                    <div class="stat">
                        <div class="stat-figure text-success">
                            <i class="text-3xl fa-solid fa-chart-simple"></i>
                        </div>
                        <div class="stat-title">Page Views</div>
                        <div class="stat-value text-success">2.6M</div>
                        <div class="stat-desc">21% </div>
                    </div>
                </div>
</html>
Copy link

Thank you @Birddle 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.

@saadeghi
Copy link
Owner

With daisyUI, you don't need to use darkMode in Tailwind config, and you don't need to use either dark: prefix or hardcoded colors like bg-slate-700
daisyUI themes manage all the colors automatically. and you don't need extra class name for dark mode.

Read this page: https://daisyui.com/docs/colors/
Or this one for more details: https://daisyui.com/blog/daisyui-colors-and-themes/

Let me know if you have a question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants