Closed LaurenzV closed 3 weeks ago
There is no background-color
in SVG.
Ah, right, so it's a CSS-only property and that's why it probably works in all other browsers.
Would you consider having support for this this though, given that it seemingly is used to some degree? I think it should be pretty straight-forward to implement, we could simply add an optional background-color
attribute to the tree, and then each renderer can do with that information whatever they want. Or out of scope?
I think we can simply add a root rectangle with a fill color from background-color
.
I thought about that, too, but I think having this separate from the main tree would be better, because each client can that do with that information what they want.
For example, let's say you are developing an SVG viewer based on usvg, if we add a root rectangle than only everything within the bounding box of the SVG will be in that color while the rest will be white, while if we store that information separately than the client application can ensure that the whole canvas is in that color, similar to how it happens in web browsers.
The whole point of usvg
is so people would not need to think about anything.
The edge case you're describing is too niche. Just a single rect
would be fine.
usvg
already strips an absurd amount of info.
Originally reported at: https://github.com/typst/typst/issues/4867
File:
resvg
output:Chrome output:
Not sure if it's a bug or just not been implemented yet.