Set default theme based on users system theme

This commit is contained in:
Chris Kankiewicz
2020-12-30 14:03:02 -07:00
parent 4dceaf2547
commit 45cc89cd45

View File

@@ -25,7 +25,7 @@ const app = new Vue({
},
},
created: function () {
this.theme = localStorage.getItem('theme') || 'light';
this.theme = localStorage.theme || (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark');
},
mounted: function() {
window.addEventListener('keyup', e => e.key === '/' && this.$refs.searchInput.focus());