From 45cc89cd457f21388230e7b74ce963dfc63d4274 Mon Sep 17 00:00:00 2001 From: Chris Kankiewicz Date: Wed, 30 Dec 2020 14:03:02 -0700 Subject: [PATCH] Set default theme based on users system theme --- app/resources/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/resources/js/app.js b/app/resources/js/app.js index bcfe1de..0c1b13c 100644 --- a/app/resources/js/app.js +++ b/app/resources/js/app.js @@ -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());