Fill attribute of text not working. I have an exported image from adobe XD. The color of the text renders correctly in Firefox and Chrome, but not in inkscape. If I add the text manually in inkscape it does work. So the bottom text does render properly
This is the fill attribute line of the top text: fill="rgba(255,255,255,0.7)" It should be semi transparent white and should look grey. In Chrome and firefox it looks ok, but not in inkscape. It only works if I use the style attribute like in the botton text: style="font-size:74.6667px;fill:#ffffff;fill-opacity:0.7" I cannot change the export
This colour representation doesn't exist in SVG1.1 so current and earlier Inkscape versions don't understand it. It's been added to Inkscape 1.5 (in development and not tested by me) as part of the ongoing progress toward SVG2 implementation.
Perhaps 1.4.1 will include the new code. Until then, I can only suggest using a regex text editor to find and replace the offending colours in your files.
Thanks. I've written a python script which uses regex that fixes it. I've also tried it with an xml parser, but I don't like how they screw up formatting and pretty printing is buggy as it ignores the xml:space="preserve" attribute and adds or removes significant spaces from text fields.
My code works with rgba colors, but also with hex colors with alpha (4 or 8 digits). rgba is simple to split, but hex colors required calculation since the opacity value only supports decimal and percentages not hex values. I've also found that stroke and flood-color can use colors with transparency so my code supports those too. I've only done limited testing so any feedback is appreciated.
Fill attribute of text not working. I have an exported image from adobe XD. The color of the text renders correctly in Firefox and Chrome, but not in inkscape.
If I add the text manually in inkscape it does work. So the bottom text does render properly
The first line has a "none" attribute in the Fill+Stroke setting. Th second line has 70% transparency applied.
This is how it looks here:
This is the fill
attributeline of the top text:
fill="rgba(255,255,255,0.7)"
It should be semi transparent white and should look grey.
In Chrome and firefox it looks ok, but not in inkscape.
It only works if I use the style attribute like in the botton text:
style="font-size:74.6667px;fill:#ffffff;fill-opacity:0.7"
I cannot change the export
I found a related discussion in a five-year-old bug report.
https://gitlab.com/inkscape/inbox/-/issues/1195
This colour representation doesn't exist in SVG1.1 so current and earlier Inkscape versions don't understand it. It's been added to Inkscape 1.5 (in development and not tested by me) as part of the ongoing progress toward SVG2 implementation.
Perhaps 1.4.1 will include the new code. Until then, I can only suggest using a regex text editor to find and replace the offending colours in your files.
Thanks. I've written a python script which uses regex that fixes it.
I've also tried it with an xml parser, but I don't like how they screw up formatting and pretty printing is buggy as it ignores the xml:space="preserve" attribute and adds or removes significant spaces from text fields.
My code works with rgba colors, but also with hex colors with alpha (4 or 8 digits).
rgba is simple to split, but hex colors required calculation since the opacity value only supports decimal and percentages not hex values.
I've also found that stroke and flood-color can use colors with transparency so my code supports those too.
I've only done limited testing so any feedback is appreciated.
Here is my code:
Latest code is here:
https://github.com/ChrisIdema/svg_alpha_fix