[Qgis-developer] SVG symbols in QGIS with modifiable colors

Otto Dassau dassau at gbd-consult.de
Thu Jul 19 00:52:30 PDT 2012


Hi,

I tried to follow the howtos in the web about defining colors for svg with
param(fill), param(outline) and param(stroke-width). 

<svg width="100%" height="100%">
<rect fill="param(fill) #ff0000" stroke="param(outline) #00ff00"
stroke-width="param(stroke-width) 10" width="100" height="100"> </rect>
</svg>

I used a copy from the svg /usr/share/qgis/svg/gpsicons/tree.svg. It looks a
little different:

[...]
     style="font-size:12px;stroke:#000000;stroke-width:3;fill:#a7a5a5;fill-opacity:
     1;stroke-miterlimit:4;stroke-dasharray:none;stroke-linejoin:miter;stroke-linecap:butt"
     d="M 56.010357,6.2503568 L 30.572857,43.031607 L 37.729107,43.031607 L
     23.666607,63.344107 L 33.072857,63.344107 L 18.291607,84.719107 L 
     46.510357,84.719107 L 46.510357,99.812857 L 65.541607,99.812857 L
     65.541607,84.687857 L 
[...]

All I managed to change is the fill value with the syntax below, but it
doesn't work for stroke and stroke width.

[...]
     style="font-size:12px;stroke:param(outline);stroke-width:param(stroke-width);
     fill:param(fill);fill-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;
     stroke-linejoin:miter;stroke-linecap:butt"
     d="M 56.010357,6.2503568 L 30.572857,43.031607 L 37.729107,43.031607 L
     23.666607,63.344107 L 33.072857,63.344107 L 18.291607,84.719107 L
     46.510357,84.719107 L 46.510357,99.812857 L 65.541607,99.812857 L
     65.541607,84.687857 
[...]

Has the syntax changed? Or how does it work with more complex svgs. I also
created a svg with inkscape, it shows the same syntax as tree.svg.

Thanks a lot
Otto





More information about the Qgis-developer mailing list