obsidian-functionplot icon indicating copy to clipboard operation
obsidian-functionplot copied to clipboard

Set colors for all charts in the vault

Open ShahriarKh opened this issue 3 years ago • 4 comments

What's your feature?

Currently, changing colors in settings only works for charts created after that. It will be really cool if the plugin supports a way to have "global" color settings, so new colors are applied to all charts in the vault.

Any related problems?

No response

Additional context?

No response

ShahriarKh avatar Nov 16 '22 19:11 ShahriarKh

The colors are applied every time the HTML for a plot is rerendered. AFAIK this also happens when you reopen obsidian. I haven't found a better way to rerender all plots, although you are welcome to add one if you find it.

leonhma avatar Nov 16 '22 20:11 leonhma

Well, I didn't notice that reopening obsidian causes colors to be updated! So, the functionality is already there; we just need to find a way to force re-render plots after saving the settings (I don't know how Obsidian handles this), or at least change the save message a little bit and tell users to "re-open obsidian to apply changes".

ShahriarKh avatar Nov 16 '22 21:11 ShahriarKh

Obsidian renders the code block via the handler function the plugin provided, and then spits out the html into a prepared div. I can't imagine the result is persistent between sessions so it would have to rerender the code block. Changing the message would be the only possible solution I could think of...

leonhma avatar Nov 16 '22 21:11 leonhma

I see. At least for now, a helpful message is better than nothing.

ShahriarKh avatar Nov 16 '22 21:11 ShahriarKh