It appears that Prince is not applying an inline color attribute like `<g color=" … " />` as the `currentColor` to elements within that group element.
I have the following snippet of SVG as part of a chart I'm rendering:
Styled with a compiled-to-CSS version of this LESS source:
In browsers the rectangle, line, and text elements are all colored as expected. But Prince is rendering all the elements using a default black stroke and fill instead of the group's assigned color.
If I enable some test CSS to apply the color via `.pct-label { color: red; }` then Prince does apply that color to the nested elements and everything in the chart turns red. But that is a poor solution in my case because the actual color needed for each group isn't really "known" to the CSS which is why it's being rendered in the HTML/SVG code, and based on browser support for this I expect it's standard behavior — i.e. it shouldn't matter whether the `currentColor` comes from a CSS property or from an inline `color=` attribute.
I have the following snippet of SVG as part of a chart I'm rendering:
<g class="pct-label" color="hsl(333deg 59% 13%)">
<rect opacity="0.62" x="150.75" width="148.5" y="15.0" height="465.0"></rect>
<line x1="150.75" x2="364.25" y1="15.0" y2="15.0"></line>
<text transform="translate(314.25, 15.0)">
<tspan class="main-val" dy="1em">42</tspan>
<tspan x="0" dy="1em">fishes</tspan>
</text>
</g>
Styled with a compiled-to-CSS version of this LESS source:
.pct-label {
/*color: red;*/
rect, text {
fill: currentColor;
}
line {
stroke: currentColor;
stroke-width: 2;
}
}
In browsers the rectangle, line, and text elements are all colored as expected. But Prince is rendering all the elements using a default black stroke and fill instead of the group's assigned color.
If I enable some test CSS to apply the color via `.pct-label { color: red; }` then Prince does apply that color to the nested elements and everything in the chart turns red. But that is a poor solution in my case because the actual color needed for each group isn't really "known" to the CSS which is why it's being rendered in the HTML/SVG code, and based on browser support for this I expect it's standard behavior — i.e. it shouldn't matter whether the `currentColor` comes from a CSS property or from an inline `color=` attribute.