Skip to content

Commit d3b4153

Browse files
committed
Fix: Update color mode on the listener only if chosenMode is system
1 parent a348d50 commit d3b4153

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/vue-dark-mode.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,11 @@ export default {
123123
},
124124
125125
handlePreferColorScheme (e) {
126-
this.currentMode = this.isSystem && e.matches ? 'dark' : 'light'
127-
this.handleClassList('remove', `${this.currentMode}-mode`)
128-
this.setMode('system')
126+
if (this.isSystem) {
127+
this.currentMode = e.matches ? 'dark' : 'light'
128+
this.handleClassList('remove', `${this.currentMode}-mode`)
129+
this.setMode('system')
130+
}
129131
},
130132
131133
toggleColorMode () {

0 commit comments

Comments
 (0)