phibr0 / obsidian-charts

Charts - Obsidian Plugin | Create editable, interactive and animated Charts in Obsidian via Chart.js
https://charts.phib.ro/
GNU Affero General Public License v3.0
592 stars 27 forks source link

Refresh chart colors app switches between light/dark mode #45

Closed kepano closed 2 years ago

kepano commented 2 years ago

This is a small QoL improvement I noticed which would be nice.

Currently when the user switches between light/dark mode, the chart colors don't change unless you close/reopen the note.

phibr0 commented 2 years ago

I also noticed that. Already looking into it, but I want to make sure to not mess up the life-cycle management again 😅

phibr0 commented 2 years ago

Is there an Event I can listen to for theme changes? Or do I need a MutationObserver on the body element to check for the theme class

kepano commented 2 years ago

The following might be useful:

https://github.com/kepano/obsidian-minimal-settings/blob/main/main.ts#L53

https://github.com/kepano/obsidian-system-dark-mode/blob/master/main.ts

phibr0 commented 2 years ago

Thanks a lot!