X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=app.js;h=a404314df8f8911597fb9dd72c1d7e1056f04fd7;hb=5323df4a32ca9b81fa598c0ca988596d93afe713;hp=dc8b6cc65ff9fe055f74cfefccc2e4b4fbcd7525;hpb=bf35e3391223659f5ad8f56dc406b85289e915ce;p=github%2Fbastienwirtz%2Fhomer.git diff --git a/app.js b/app.js index dc8b6cc..a404314 100644 --- a/app.js +++ b/app.js @@ -4,7 +4,8 @@ const app = new Vue({ config: null, offline: false, filter: '', - vlayout: true + vlayout: true, + overrideDark: null }, created: function () { let that = this; @@ -22,6 +23,13 @@ const app = new Vue({ } }, false); }, + computed: { + isDark: function() { + return this.overrideDark !== null + ? this.overrideDark + : matchMedia("(prefers-color-scheme: dark)").matches; + } + }, methods: { checkOffline: function () { let that = this; @@ -44,6 +52,9 @@ const app = new Vue({ }); }); }, + toggleTheme: function() { + this.overrideDark = !this.isDark; + } } });