summaryrefslogtreecommitdiff
path: root/src/client/app/desktop/script.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-04-20 03:41:24 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-04-20 03:41:24 +0900
commitf2fea7f3cd5a131f994ad9bc1d2b4833865dd165 (patch)
treebe47b9e8aa5bcf8d400960a75adcfea30b5982dc /src/client/app/desktop/script.ts
parent:art: (diff)
downloadsharkey-f2fea7f3cd5a131f994ad9bc1d2b4833865dd165.tar.gz
sharkey-f2fea7f3cd5a131f994ad9bc1d2b4833865dd165.tar.bz2
sharkey-f2fea7f3cd5a131f994ad9bc1d2b4833865dd165.zip
[wip] darkmode
Diffstat (limited to 'src/client/app/desktop/script.ts')
-rw-r--r--src/client/app/desktop/script.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/client/app/desktop/script.ts b/src/client/app/desktop/script.ts
index b3152e708b..ba7a64ff22 100644
--- a/src/client/app/desktop/script.ts
+++ b/src/client/app/desktop/script.ts
@@ -2,6 +2,7 @@
* Desktop Client
*/
+import Vue from 'vue';
import VueRouter from 'vue-router';
// Style
@@ -43,6 +44,30 @@ init(async (launch) => {
require('./views/components');
require('./views/widgets');
+ // Dark/Light
+ Vue.mixin({
+ mounted() {
+ const set = () => {
+ if (!this.$el || !this.os || !this.os.i) return;
+ if (this.os.i.clientSettings.dark) {
+ document.documentElement.setAttribute('data-darkmode', 'true');
+ this.$el.setAttribute('data-darkmode', 'true');
+ } else {
+ document.documentElement.removeAttribute('data-darkmode');
+ this.$el.removeAttribute('data-darkmode');
+ }
+ };
+
+ set();
+
+ this.$watch('os.i.clientSettings', i => {
+ set();
+ }, {
+ deep: true
+ });
+ }
+ });
+
// Init router
const router = new VueRouter({
mode: 'history',