I have a site which uses <object> to render external SVGs, many of which have transparent backgrounds. I added the CSS property color-scheme: dark, indicating that it "can be rendered using the operating system dark color scheme". However, in Chrome/Blink, this results in the <object> elements having white backgrounds! This is a minimal demo:
:root {
background-color: blue;
/*
In Chrome/Edge, the following makes the <object> have a white background!
In Firefox/Safari, it stays transparent.
*/
color-scheme: dark;
}
body {
margin: 0;
}
<object
type="image/svg+xml"
data="data:image/svg+xml,%3Csvg version='1.1' width='300' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='150' cy='100' r='80' fill='green' /%3E%3C/svg%3E%0A">
SVG not supported
</object>
What's going on here? Is this a bug in Chromium? Or is there something about <object>, SVG, or color-scheme that I have misunderstood?