Skip to content

Commit

Permalink
Fixes issue nuxt-modules#202
Browse files Browse the repository at this point in the history
if local sotrage is not available it will fallback
  • Loading branch information
szwenni committed Jul 23, 2023
1 parent aa2de9e commit 3ca7b26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

const knownColorSchemes = ['dark', 'light']

const preference = window.localStorage.getItem('<%= options.storageKey %>') || '<%= options.preference %>'
const preference = window?.localStorage?.getItem('<%= options.storageKey %>') || '<%= options.preference %>'
let value = preference === 'system' ? getColorScheme() : preference
// Applied forced color mode
const forcedColorMode = de.getAttribute('data-color-mode-forced')
Expand Down

0 comments on commit 3ca7b26

Please sign in to comment.