small fix for theme picking/seting
This commit is contained in:
@@ -316,8 +316,8 @@ window.windowMixin = {
|
||||
methods: {
|
||||
changeColor: function (newValue) {
|
||||
document.body.setAttribute('data-theme', newValue)
|
||||
console.log(document.body.getAttribute('data-theme'))
|
||||
console.log(newValue)
|
||||
//console.log(document.body.getAttribute('data-theme'))
|
||||
//console.log(newValue)
|
||||
this.$q.localStorage.set('lnbits.theme', newValue)
|
||||
},
|
||||
toggleDarkMode: function () {
|
||||
@@ -337,12 +337,19 @@ window.windowMixin = {
|
||||
created: function () {
|
||||
this.$q.dark.set(this.$q.localStorage.getItem('lnbits.darkMode'))
|
||||
this.g.allowedThemes = window.allowedThemes
|
||||
if (this.$q.localStorage.getItem('lnbits.theme')) {
|
||||
document.body.setAttribute(
|
||||
'data-theme',
|
||||
this.$q.localStorage.getItem('lnbits.theme')
|
||||
)
|
||||
|
||||
let theme = this.$q.localStorage.getItem('lnbits.theme')
|
||||
|
||||
// failsafe if admin changes themes halfway
|
||||
if (theme && !this.g.allowedThemes.includes(theme)) {
|
||||
console.log('allowedThemes changed by Admin', this.g.allowedThemes[0])
|
||||
this.changeColor(this.g.allowedThemes[0] || 'classic')
|
||||
}
|
||||
|
||||
if (theme) {
|
||||
document.body.setAttribute('data-theme', theme)
|
||||
}
|
||||
|
||||
if (window.user) {
|
||||
this.g.user = Object.freeze(window.LNbits.map.user(window.user))
|
||||
}
|
||||
|
||||
@@ -53,6 +53,13 @@ $themes: (
|
||||
[data-theme='#{$theme}'] .q-menu--dark {
|
||||
background: $color !important;
|
||||
}
|
||||
|
||||
/* IF WANTING TO SET A DARKER BG COLOR IN THE FUTURE
|
||||
// set a darker body bg for all themes, when in "dark mode"
|
||||
body[data-theme='#{$theme}'].body--dark {
|
||||
background: scale-color($color, $lightness: -60%);
|
||||
}
|
||||
*/
|
||||
}
|
||||
@if $name == 'info' {
|
||||
[data-theme='#{$theme}'] .q-card--dark,
|
||||
|
||||
Reference in New Issue
Block a user