Jump to content
You must now use your email address to sign in [click for more info] ×

rgba in SVG not supported


Recommended Posts

  • Staff

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

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

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

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.