fix: chart color for darkmode (#3525)

This commit is contained in:
dni ⚡ 2025-11-13 17:12:35 +01:00 committed by GitHub
parent ee57ba4c1a
commit 20f9ddb57c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 5 deletions

File diff suppressed because one or more lines are too long

View file

@ -11,6 +11,7 @@ window.app.component('lnbits-theme', {
'g.darkChoice'(val) { 'g.darkChoice'(val) {
this.$q.dark.set(val) this.$q.dark.set(val)
this.$q.localStorage.set('lnbits.darkMode', val) this.$q.localStorage.set('lnbits.darkMode', val)
Chart.defaults.color = this.$q.dark.isActive ? '#fff' : '#000'
}, },
'g.borderChoice'(val) { 'g.borderChoice'(val) {
document.body.classList.forEach(cls => { document.body.classList.forEach(cls => {
@ -93,12 +94,10 @@ window.app.component('lnbits-theme', {
} }
}, },
created() { created() {
// TODO: fix Chart global import each chart has to take care of its own config
// else there is no reactivity on theme change
Chart.defaults.color = this.$q.dark.isActive ? '#fff' : '#000'
this.$q.dark.set(this.g.darkChoice) this.$q.dark.set(this.g.darkChoice)
document.body.setAttribute('data-theme', this.g.themeChoice) document.body.setAttribute('data-theme', this.g.themeChoice)
Chart.defaults.color = this.$q.dark.isActive ? '#fff' : '#000'
document.body.classList.add(this.g.borderChoice) document.body.classList.add(this.g.borderChoice)
if (this.g.gradientChoice === true) { if (this.g.gradientChoice === true) {
document.body.classList.add('gradient-bg') document.body.classList.add('gradient-bg')