Transparent fill is black

Asked by Thad Humphries

First, i should say I'm running Inkscape 0.91 on Mac 10.10.5 under XQuartz 2.7.7. Inkscape was installed with Inkscape-0.91-1-x11-10.7-x86_64.dmg.

I have a simple SVG with 4 circles:

<svg version="1.1"
     baseProfile="full"
     width='100%' height='100%'
     viewBox="0 0 210 210"
     xmlns="http://www.w3.org/2000/svg">

  <circle cx="105" cy="105" r="100" fill="white" />
  <circle cx="105" cy="105" r="62" fill="#016ab6" />
  <circle cx="68" cy="68" r="20" fill="white" />
  <circle cx="105" cy="105" r="83" stroke="#7b7d8c"
    fill="transparent" stroke-width="17" />

</svg>

When I open this image in Inkscape, it displays the gray circle, but the transparent fill is black. If I move this element I can see the others underneath. If I do a Save As... on the original image, it still displays correctly, so the problem seems to be only with the display of the transparent fill.

Question information

Language:
English Edit question
Status:
Solved
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Solved by:
su_v
Solved:
Last query:
Last reply:
Revision history for this message
Best su_v (suv-lp) said :
#1

If you hand-coded that SVG file, please visit the current SVG 1.1 spec about how to define paint servers and e.g. various types of opacity.

Specifying paint for fill/stroke:
http://www.w3.org/TR/SVG11/painting.html#SpecifyingPaint

Specifying transparency (aka opacity) for the fill:
http://www.w3.org/TR/SVG11/painting.html#FillOpacityProperty

For no fill, use e.g. 'fill="none"', for a fully transparent fill 'fill-opacity="0"'.

The SVG renderer Batik is for example quite explicit about the error (and renders the SVG 1.1 file the same as Inkscape):
> The attribute "fill" represents an invalid CSS value ("transparent").
> Original message:
> The "transparent" identifier is not a valid value for the "fill" property.

Revision history for this message
su_v (suv-lp) said :
#2

Additional hint: Inkscape does not write presentation attributes (it does support reading them to compute the current style for rendering). Whenever you open such a hand-coded or externally generated SVG file (which only uses presentation attributes for style properties) in Inkscape, and edit an object with presentation attibutes, then the current style of the object is rewritten as CSS inline 'style' attribute with CSS property declarations (the corresponding presentation attributes are not deleted, since the 'style' attribute takes precedence anyway in modern SVG viewers). IF you later edit the saved SVG file externally again, and only modify presentation attributes again, make sure to either delete any 'style' attribute added by Inkscape, or to change the specific property in both places.

Revision history for this message
Thad Humphries (thad-humphries) said :
#3

Thanks ~suv, that solved my question.