whatwg / whatwg.org

The WHATWG website and other static resources
https://whatwg.org/
Other
76 stars 50 forks source link

Defensively guard against non-darkmode-aware SVGs by giving them a white background. #439

Closed tabatkins closed 6 months ago

tabatkins commented 6 months ago

SVGs are usually authored with a transparent background, and usually assume they're displayed against a light background, using black text/etc. This often renders them unreadable in darkmode.

To guard against this, this PR automatically gives them a white background, unless they have a .darkmode-aware class.

See also https://github.com/whatwg/html/pull/10257, where I'm fixing all of HTML's SVG's to be darkmode-aware. These PRs can be merged in either order; both "fix" the problem, this one just does it in a slightly less good (but more generic) way. I'll probably review the other WHATWG specs for SVG diagrams that need to be flagged as well, but later.