79358878

Date: 2025-01-15 15:53:24
Score: 2.5
Natty:
Report link

Why don't you just declare html.light and html.dark and use js just to switch this classes?

setTheme(theme){
    if (theme == "dark") {
        document.querySelector("html").classList.remove("light");
        document.querySelector("html").classList.add("dark");
    } else {       
        document.querySelector("html").classList.remove("dark");
        document.querySelector("html").classList.add("light");
    }
}
Reasons:
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Starts with a question (0.5): Why don't you
  • Low reputation (0.5):
Posted by: René Baudisch