diff options
author | Bastien Wirtz <bastien.wirtz@gmail.com> | 2019-10-01 21:35:51 -0700 |
---|---|---|
committer | Bastien Wirtz <bastien.wirtz@gmail.com> | 2019-10-01 21:40:45 -0700 |
commit | 5323df4a32ca9b81fa598c0ca988596d93afe713 (patch) | |
tree | f6a7caacb2b44621839265ffa5edc9ec7dc9c952 /app.js | |
parent | bf35e3391223659f5ad8f56dc406b85289e915ce (diff) | |
download | homer-5323df4a32ca9b81fa598c0ca988596d93afe713.tar.gz homer-5323df4a32ca9b81fa598c0ca988596d93afe713.tar.zst homer-5323df4a32ca9b81fa598c0ca988596d93afe713.zip |
Implementing dark mode
Diffstat (limited to 'app.js')
-rw-r--r-- | app.js | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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 | ||