ivanceras / svgbob

Convert your ascii diagram scribbles into happy little SVG
http://ivanceras.github.io/svgbob-editor/
Apache License 2.0
3.88k stars 109 forks source link

Browsers' automatic dark mode theme generation breaks svgbob #112

Open ssokolow opened 6 months ago

ssokolow commented 6 months ago

I showed a friend a creation of mine which embeds svgbob output in HTML pages, and he was only getting white squares.

It turned out that Firefox's equivalent to this Chrome feature was breaking it by overriding the stroke color from black to white without overriding the fill color from white to black.

(I mention Chrome because I don't know how to test it in Firefox on Linux, but Ungoogled Chromium has "Automatic dark mode" under the paintbrush icon in the DOM explorer's styles pane.)

I was able to get it working for him by adding this to my stylesheet so it would just rely on the underlying background color that the browsers were correctly detecting as something needing to be processed:

/* Fix automatic dark-mode compatibility for svgbob */
.svgbob rect.backdrop, .svgbob .nofill {
    fill: transparent !important;
}

I don't know if there are others that would need to be changed if working that way. That was just the cases that actually got used in my demo diagram.

(And I had to get a workaround promptly because he didn't know how to turn it off. He says it happened automatically in response to modern Windows being in night mode.)