Topic: How can I implement the switch to dark mode theme?

mustafa.salaheldin free asked 11 months 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?


Kamila Pieńkowska staff answered 11 months ago


Please go over the instructions again. You were not supposed to include those files in HTML but import dark mode in SCSS.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Opened

Specification of the issue

  • ForumUser: 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