TW-Elements
TW-Elements copied to clipboard
[DarkMode] [Dark mode class not working with Chrome's default dark theme.]
Dark mode class not working with Chrome's default dark theme. As a user, I would expect the darkMode class to consistently apply dark styles regardless of the browser's default theme. If possible, adjustments to the darkMode class or additional guidance on handling default browser themes could help address this issue.
To Reproduce Steps to reproduce the behavior:
- Create a website using Tailwind CSS.
- Implement a darkMode class to enable dark theme on the site.
- Load the website in Chrome with its default dark theme enabled.
- Observe that the darkMode class does not apply consistent dark styles as expected.
Expected behavior When using the darkMode class to enable dark theme on my site, the dark styles should be applied consistently across different themes, including Chrome's default dark theme
Actual behavior The dark mode styles, applied using the darkMode class, are not functioning correctly when Chrome's default dark theme is active. The styles are not being applied as expected, leading to inconsistent appearance and conflicts with other div elements intended for dark themes.
Show your code `<div className={darkMode ? "dark" : "light"} > <main className=' px-8 md:px-20 lg:px-40 bg-white dark:bg-gray-800'> <section className=' min-h-screen dark:bg-gray-90'><nav className='py-10 mb-12 flex justify-between'> <div className=' bg-cover bg-center background'> <h1 className='text-3xl px-5 font-semibold mix-blend-lighten text-black bg-white'>TWRECKS <ul className='flex items-center'>
Desktop (please complete the following information):
- OS: Windows 11
- Browser Chrome
- Version 115.0.5790.110
- tailwind css v3.3.3
Smartphone (please complete the following information):
- Device: Any Android device
- OS: Android 11
- Browser chrome, duck duck go
- Version 115 (115.0.5790.166)
Hi I'm not sure if I uderstand correctly. We do not support adding the dark
class to a single element. Some of the components have content that is added at the end of body (like Select, Datepicker, Timepicker) and that would make the darkmode not to work properly.
If you want to change the theme, add (or remove) the dark
class to the html
element if you are using the darkMode: "class"
setting in tailwind.config.js
.