Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@

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

const preference = getStorageValue('<%= options.storage %>', '<%= options.storageKey %>') || '<%= options.preference %>'
const storedPreference = getStorageValue('<%= options.storage %>', '<%= options.storageKey %>')
const configPreference = '<%= options.preference %>'

// Use config preference if it's not 'system', otherwise use stored preference or fallback to config
const preference = configPreference !== 'system' ? configPreference : (storedPreference || configPreference)
let value = preference === 'system' ? getColorScheme() : preference

// Applied forced color mode
const forcedColorMode = de.getAttribute('data-color-mode-forced')
if (forcedColorMode) {
Expand Down
Loading