I spent some time looking at getting Eukleides and JSXGraph diagrams to change their colours automatically, but in practice whatever I did would have been equivalent to just inverting the colours on the whole element as if it was a static image.
So I've put a white background behind all images, and added a display option to invert images when the background is dark. That option is off by default, so students will see a white background behind images even in dark mode, unless they explicitly turn the option on.
Inverting colours makes photos look very weird, so I think it's safest to not do it by default.