theme = 'light' // Whenever the user explicitly chooses dark mode localStorage. matches ) ) // Whenever the user explicitly chooses light mode localStorage. matchMedia ( '(prefers-color-scheme: dark)' ). theme = 'dark' || ( ! ( 'theme' in localStorage ) & window. On page load or when changing themes, best to add inline in `head` to avoid FOUC if ( localStorage.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |