Skip to content

Marionetko/light-dark-mode-switcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

light-dark-mode-switcher

Demo

localStorage API using

For a better user experience, I will use localStorage which will store the user's current theme, that way when the user comes back to the website, their favorite theme will be applied automatically.

// storing the theme on the user's machine
localStorage.setItem('theme', 'dark');

//accessed the user's machine theme
localStorage.getItem('theme');
// dark