Comment 7 for bug 166213

Revision history for this message
Peter Williams (k-peter) wrote : Re: implement SVG 1.2 "background" property

Even though this bug is more than five years old, it's still valid, as far as I can tell.

If you create a file in Inkscape, set its background color to something random (non-transparent blue, say), and export to Plain SVG, the exported file does not have a blue background. If you look at the XML, the background information is nowhere to be found.

In Inkscape's defense, the SVG spec seems to completely fall down on this basic functionality. The SVG 1.2 Tiny specification does define a "viewport-fill" property on the <svg> element that can be used to define a background fill: http://www.w3.org/TR/SVGTiny12/painting.html#viewport-fill-property .

However, it appears that SVG 2 is going to go another route: see the discussions at http://www.w3.org/2012/07/23-svg-minutes.html . The current plan appears to be that CSS styling will be used, and you can write <svg style="background-color: #abcdef">

I'm attaching two sample files gleaned from the specifications that I think should demonstrate the two techniques. Neither gets a colored background in EOG. The viewport-fill method doesn't work in Firefox. However, the CSS background test file does get a colored background when viewed in Firefox.

Given the current situation, exporting via the CSS background-color property seems like it should be better than nothing. Will unexpected properties cause other SVG viewers to freak out?