Skip to content

Commit 62e5dbb

Browse files
committed
Use system default for theme IF not overridden
1 parent 7f29cac commit 62e5dbb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/App.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ export default {
107107
},
108108
beforeCreate() {
109109
const t = localStorage.getItem("dark-theme");
110-
if (t === "dark") {
110+
//if the storage doesn't indicate one, and the system is dark, use dark
111+
if ((window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches && !t) || t === 'dark') {
111112
this.$vuetify.theme.dark = true;
112113
}
113114
},

0 commit comments

Comments
 (0)