Fixes setting theme from account (#2939)
* getting there * working * make
This commit is contained in:
parent
10c60291d2
commit
90dd3cc73a
2 changed files with 9 additions and 11 deletions
2
lnbits/static/bundle.min.js
vendored
2
lnbits/static/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -588,6 +588,7 @@ window.windowMixin = {
|
||||||
changeTheme(newValue) {
|
changeTheme(newValue) {
|
||||||
document.body.setAttribute('data-theme', newValue)
|
document.body.setAttribute('data-theme', newValue)
|
||||||
if (this.themeSelection) {
|
if (this.themeSelection) {
|
||||||
|
this.themeChoice = newValue
|
||||||
this.$q.localStorage.set('lnbits.theme', newValue)
|
this.$q.localStorage.set('lnbits.theme', newValue)
|
||||||
}
|
}
|
||||||
this.setColors()
|
this.setColors()
|
||||||
|
|
@ -596,13 +597,11 @@ window.windowMixin = {
|
||||||
darkBgColor = this.$q.localStorage.getItem('lnbits.darkBgColor')
|
darkBgColor = this.$q.localStorage.getItem('lnbits.darkBgColor')
|
||||||
primaryColor = this.$q.localStorage.getItem('lnbits.primaryColor')
|
primaryColor = this.$q.localStorage.getItem('lnbits.primaryColor')
|
||||||
if (this.gradientChoice) {
|
if (this.gradientChoice) {
|
||||||
|
this.$q.localStorage.set('lnbits.gradientBg', true)
|
||||||
if (!this.$q.dark.isActive) {
|
if (!this.$q.dark.isActive) {
|
||||||
this.$q.dark.toggle()
|
this.$q.dark.toggle()
|
||||||
this.$q.localStorage.set('lnbits.darkMode', true)
|
this.$q.localStorage.set('lnbits.darkMode', true)
|
||||||
}
|
}
|
||||||
if (this.gradientSelection) {
|
|
||||||
this.$q.localStorage.set('lnbits.gradientBg', true)
|
|
||||||
}
|
|
||||||
const gradientStyle = `linear-gradient(to bottom right, ${LNbits.utils.hexDarken(String(primaryColor), -70)}, #0a0a0a)`
|
const gradientStyle = `linear-gradient(to bottom right, ${LNbits.utils.hexDarken(String(primaryColor), -70)}, #0a0a0a)`
|
||||||
document.body.style.setProperty(
|
document.body.style.setProperty(
|
||||||
'background-image',
|
'background-image',
|
||||||
|
|
@ -617,15 +616,15 @@ window.windowMixin = {
|
||||||
`[data-theme="${this.themeChoice}"] .q-card--dark{background: ${String(darkBgColor)} !important;} }`
|
`[data-theme="${this.themeChoice}"] .q-card--dark{background: ${String(darkBgColor)} !important;} }`
|
||||||
document.head.appendChild(style)
|
document.head.appendChild(style)
|
||||||
} else {
|
} else {
|
||||||
if (this.gradientSelection) {
|
|
||||||
this.$q.localStorage.set('lnbits.gradientBg', false)
|
this.$q.localStorage.set('lnbits.gradientBg', false)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
toggleDarkMode() {
|
toggleDarkMode() {
|
||||||
this.$q.dark.toggle()
|
this.$q.dark.toggle()
|
||||||
this.$q.localStorage.set('lnbits.darkMode', this.$q.dark.isActive)
|
this.$q.localStorage.set('lnbits.darkMode', this.$q.dark.isActive)
|
||||||
if (this.gradientChoice && !this.$q.dark.isActive) {
|
if (this.gradientChoice && !this.$q.dark.isActive) {
|
||||||
|
this.$q.localStorage.set('lnbits.gradientBg', false)
|
||||||
|
this.$q.localStorage.remove(`lnbits.backgroundImage`)
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -640,12 +639,11 @@ window.windowMixin = {
|
||||||
if (
|
if (
|
||||||
this.bgimageChoice &&
|
this.bgimageChoice &&
|
||||||
this.bgimageChoice !== 'null' &&
|
this.bgimageChoice !== 'null' &&
|
||||||
|
this.bgimageChoice !== 'none' &&
|
||||||
this.bgimageChoice !== ''
|
this.bgimageChoice !== ''
|
||||||
) {
|
) {
|
||||||
if (!this.gradientChoice) {
|
|
||||||
this.gradientChoice = true
|
this.gradientChoice = true
|
||||||
this.applyGradient()
|
this.applyGradient()
|
||||||
}
|
|
||||||
const style = document.createElement('style')
|
const style = document.createElement('style')
|
||||||
style.innerHTML = `
|
style.innerHTML = `
|
||||||
body[data-theme="${this.themeChoice}"]::before {
|
body[data-theme="${this.themeChoice}"]::before {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue