Closed derMart closed 1 year ago
update: it does belong to the svg spec: https://www.w3.org/TR/SVG11/color.html#ColorProperty
The currentColor
property is not supported by svg2pdf. We are happy about pull requests, though.
For an implementation, we need to add a color
property to the AttributeState
and read this value in parseAttributes
if the value of an attribute is currentColor
.
This is a nice feature to have, especially in the conjunction with use
elements as differently-colored glyphs. I am using this in some of my apps, so currently this would not really work with the export. Specifying the state from outside is also possible, of course, but that would require an API change, I guess. I think I would rather not overload the meaning of document.setFillColor().
Hi guys,
I've raised a pull request #158 that (mostly) implements currentColor. Please feel free to make any further edits if required!
Given that #158 has been merged, I take it this issue can be closed?
I am not sure if this is a bug or I took the wrong approach or this even does not belong to the svg spec. When embedding an svg into html you can specify
<path fill="currentColor" .../>
to let the fill color be determined by the 'parent' scope. I tried the same using svg2pdf.js but it just draws nothing. I tried to specify doc.setFillColor('#000000'); before drawing the svg into the doc, but it didn't help either.Is it possible to use the currentColor value while drawing an svg using svg2pdf.js?
kind regards Martin