netsi1964 Posted October 29, 2017 Share Posted October 29, 2017 Hi, Seems that colors in SVG files using RGBA (RGB with Alpha value) is rendered with 100% opacity. I have attached an example SVG file. Did I mention that also HSLA colors are not handled correctly? /Sten myspace.svg Link to comment Share on other sites More sharing options...
Staff Sean P Posted October 30, 2017 Staff Share Posted October 30, 2017 Hi Sten, As far as I'm aware this is not allowed by the SVG specification - colours must be applied using rgb(#,#,#,) and the opacity is then specified using fill-opacity. If I open your SVG up in Inkscape, the objects appear as black and selecting them reports 'Paint is undefined' in the Fill panel. Opening the file in Illustrator also displays the items as black. This would also explain why colours specificed using HSLA does not work - they have to be provided as RGB/Hex values. Opening the file inside a browser does correctly show the green, however this (I presume) is because the browser is parsing that as regular CSS which supports rgbA. EDIT: You should also add the following to the SVG tag if you want the file to be correctly openable by web browsers. Without this all browsers failed to parse and display it as an SVG and instead just showed the file's contest as text. xmlns="http://www.w3.org/2000/svg" Link to comment Share on other sites More sharing options...
netsi1964 Posted October 30, 2017 Author Share Posted October 30, 2017 Thanks Sean. It is valid not to parse post CSS-2 color values, as you state - since SVG 1.1 is only defined to be understanding CSS-2. However in SVG 2 it is expected/discussed (?) that CSS-3 colors will/should be supported (https://dev.w3.org/SVG/modules/color/master/SVGColor.html) :-) But I understand. Would be great then if Affinity Designer/Photo would allow for javascript based macros (like in say Sketch), so that users could build code to handle incoming CSS-3 based SVG files, and then convert any CSS-3 color to say "fill-opacity". Link to comment Share on other sites More sharing options...
mdriftmeyer Posted October 31, 2017 Share Posted October 31, 2017 Great, but SVG 2 is not supported in any browser platform and as far as I have followed with the browser developers they have put it dead last as a priority; hence the Tiny 1.2 spec endorsement. Until WebKit 2 and Chrome Blink, etc., have SVG 2 built in you won't see vector graphics programs like Inkscape, Illustrator, etc., waste efforts on SVG 2. We're getting to 1.2 when it was released in 2008. Link to comment Share on other sites More sharing options...
netsi1964 Posted October 31, 2017 Author Share Posted October 31, 2017 All I wish for is the support for CSS 3 part of SVG 2 :-) Link to comment Share on other sites More sharing options...
Recommended Posts