From 4e43d2d52ee6976a262f651f98c9165807da8eb8 Mon Sep 17 00:00:00 2001 From: Ben Arc Date: Wed, 30 Jun 2021 12:40:58 +0100 Subject: [PATCH] theme saved and works --- lnbits/static/js/base.js | 7 ++++++- lnbits/static/scss/base.scss | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lnbits/static/js/base.js b/lnbits/static/js/base.js index 863d022c..84a73b13 100644 --- a/lnbits/static/js/base.js +++ b/lnbits/static/js/base.js @@ -307,7 +307,8 @@ window.windowMixin = { extensions: [], user: null, wallet: null, - payments: [] + payments: [], + } } }, @@ -317,6 +318,7 @@ window.windowMixin = { document.body.setAttribute('data-theme', newValue) console.log(document.body.getAttribute('data-theme')) console.log(newValue) + this.$q.localStorage.set('lnbits.theme', newValue) }, toggleDarkMode: function () { this.$q.dark.toggle() @@ -334,6 +336,9 @@ window.windowMixin = { }, created: function () { this.$q.dark.set(this.$q.localStorage.getItem('lnbits.darkMode')) + if (this.$q.localStorage.getItem('lnbits.theme')){ + document.body.setAttribute('data-theme', this.$q.localStorage.getItem('lnbits.theme')) + } if (window.user) { this.g.user = Object.freeze(window.LNbits.map.user(window.user)) } diff --git a/lnbits/static/scss/base.scss b/lnbits/static/scss/base.scss index 76d0fbf9..e34f1a65 100644 --- a/lnbits/static/scss/base.scss +++ b/lnbits/static/scss/base.scss @@ -29,7 +29,7 @@ $themes: ( @each $name, $color in $colors { @if $name == 'dark' { [data-theme='#{$theme}'] .q-drawer--dark, - body.body--dark [data-theme='#{$theme}'] .q-layout, + body[data-theme='#{$theme}'].body--dark, [data-theme='#{$theme}'] .q-menu--dark { background: $color !important; }