theme saved and works

This commit is contained in:
Ben Arc 2021-06-30 12:40:58 +01:00
parent 40f50135bb
commit 4e43d2d52e
2 changed files with 7 additions and 2 deletions

View file

@ -307,7 +307,8 @@ window.windowMixin = {
extensions: [], extensions: [],
user: null, user: null,
wallet: null, wallet: null,
payments: [] payments: [],
} }
} }
}, },
@ -317,6 +318,7 @@ window.windowMixin = {
document.body.setAttribute('data-theme', newValue) document.body.setAttribute('data-theme', newValue)
console.log(document.body.getAttribute('data-theme')) console.log(document.body.getAttribute('data-theme'))
console.log(newValue) console.log(newValue)
this.$q.localStorage.set('lnbits.theme', newValue)
}, },
toggleDarkMode: function () { toggleDarkMode: function () {
this.$q.dark.toggle() this.$q.dark.toggle()
@ -334,6 +336,9 @@ window.windowMixin = {
}, },
created: function () { created: function () {
this.$q.dark.set(this.$q.localStorage.getItem('lnbits.darkMode')) 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) { if (window.user) {
this.g.user = Object.freeze(window.LNbits.map.user(window.user)) this.g.user = Object.freeze(window.LNbits.map.user(window.user))
} }

View file

@ -29,7 +29,7 @@ $themes: (
@each $name, $color in $colors { @each $name, $color in $colors {
@if $name == 'dark' { @if $name == 'dark' {
[data-theme='#{$theme}'] .q-drawer--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 { [data-theme='#{$theme}'] .q-menu--dark {
background: $color !important; background: $color !important;
} }