..

How to fix SVGs for dark mode?

This one's easy. I'm assuming that SVG is imported using an img tag.

Open your SVG file in beloved VIM or Emacs's evil mode. Do this:

:%s/stroke="rgb(0,0,0)"/stroke="currentColor"/
:%s/fill="rgb(0,0,0)"/fill="currentColor"/

Or you could just use sed. Anyway, then add

style="background: #ffffff; background-color: light-dark(#ffffff, var(--ge-dark-color, #000000)); color-scheme: light dark;"

to the top of your SVG file in your svg tag, here's a diff from my own blog's commits:

-<svg version="1.2" width="44.92mm" height="130.98mm" viewBox="0 0 4492 13098" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xml:space="preserve">
+<svg style="background: #ffffff; background-color: light-dark(#ffffff, var(--ge-dark-color, #000000)); color-scheme: light dark;" version="1.2" width="44.92mm" height="130.98mm" viewBox="0 0 4492 13098" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xml:space="preserve">