aboutsummaryrefslogtreecommitdiffhomepage
path: root/app.js
diff options
context:
space:
mode:
authorBastien Wirtz <bastien.wirtz@gmail.com>2019-10-02 08:48:01 -0700
committerGitHub <noreply@github.com>2019-10-02 08:48:01 -0700
commit1312fe5d1a44657ced6b2b92a870cacab1311d99 (patch)
treef6a7caacb2b44621839265ffa5edc9ec7dc9c952 /app.js
parentbf35e3391223659f5ad8f56dc406b85289e915ce (diff)
parent5323df4a32ca9b81fa598c0ca988596d93afe713 (diff)
downloadhomer-1312fe5d1a44657ced6b2b92a870cacab1311d99.tar.gz
homer-1312fe5d1a44657ced6b2b92a870cacab1311d99.tar.zst
homer-1312fe5d1a44657ced6b2b92a870cacab1311d99.zip
Merge pull request #2 from bastienwirtz/dark-mode
Implementing dark mode
Diffstat (limited to 'app.js')
-rw-r--r--app.js13
1 files changed, 12 insertions, 1 deletions
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({
4 config: null, 4 config: null,
5 offline: false, 5 offline: false,
6 filter: '', 6 filter: '',
7 vlayout: true 7 vlayout: true,
8 overrideDark: null
8 }, 9 },
9 created: function () { 10 created: function () {
10 let that = this; 11 let that = this;
@@ -22,6 +23,13 @@ const app = new Vue({
22 } 23 }
23 }, false); 24 }, false);
24 }, 25 },
26 computed: {
27 isDark: function() {
28 return this.overrideDark !== null
29 ? this.overrideDark
30 : matchMedia("(prefers-color-scheme: dark)").matches;
31 }
32 },
25 methods: { 33 methods: {
26 checkOffline: function () { 34 checkOffline: function () {
27 let that = this; 35 let that = this;
@@ -44,6 +52,9 @@ const app = new Vue({
44 }); 52 });
45 }); 53 });
46 }, 54 },
55 toggleTheme: function() {
56 this.overrideDark = !this.isDark;
57 }
47 } 58 }
48}); 59});
49 60