Design comparison
SolutionDesign
Community feedback
- @TKSHIIPosted about 2 years ago
You should not use "var" anymore, but "let".
For light and dark mode you have to put an eventListener click on the switch dark/light button. Then you create dark and white class with background: dark for the dark and light for the light.
You select all darkmode changing elements with your JS and put each one in variable. let todoList = document.querySelector('.todolist') etc.. for each.
Then on click on the dark/light button on top it will call a function that will put the dark class to each elements if the theme is dark or light for the light theme.
Thats it :)
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord