obsidian-execute-code
obsidian-execute-code copied to clipboard
Magic to retrieve dark/light mode setting information
I would like to render my code outputs differently based on if light or dark mode is used in settings (e.g. make plots white on black or black on white). I imagine this would most likely take the form of a magic command most likely. There are probbaly some other options that might be useful as well, but I don't know which.
Seen #187. If you can set a background in the programming language plotter (i.e. set_facecolor in matplotlib), then you can write a short line to have two different background colours set.
For example ax.set_facecolor('white' if @theme == 'light' else 'black').
You could actually just set two dictionaries of colours you want (some colorscheme) and select either dictionary using this for a range of different colours.
All of this logic could be additionally implemented in a pre codeblock or in the code that is run every time from settings.