Topic: How can I implement the switch to dark mode theme?
mustafa.salaheldin asked 2 years ago
I followed the setup of the dark mode theme in the documentation fond in this link here. I included both mdb.dark.min.css and mdb.min.css files in my HTML page header, then I used the JavaScript code to allow the toggle between light and dark themes.
const skinToggler = document.getElementById('skinToggler');
const toggleSkin = () => {
document.body.classList.toggle('dark');
}
skinToggler.addEventListener('click', toggleSkin);
The issue is it didn't work, as when I add the dark theme the HTML page catch it and apply it and most of the components colors are not correct. Can you please advise?
kpienkowska staff answered 2 years ago
Please go over the instructions again. You were not supposed to include those files in HTML but import dark mode in SCSS.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Open
- User: Free
- Premium support: No
- Technology: MDB Standard
- MDB Version: MDB5 3.3.0
- Device: Laptop
- Browser: Microsoft Edge
- OS: Windows 10 64-bit
- Provided sample code: No
- Provided link: Yes