2

I don't understand why SVG symbols, which are colors changeable in the symbol default installation like this airplane:

enter image description here

enter image description here

whereas there symbols like the transport bus station, and lighting symbol (that i have been created in inkscape 0.91) that don't have any option to change the fill colors and the outline?

enter image description here

enter image description here

I have red Changing colours in SVG symbol using QGIS? and didn't got suitable answer.

1 Answer 1

2

You need to modify the content of the SVG file and an answer was given in GIS SE (How to create svg symbols that have modifiable fill color, stroke color and stroke width?) and in Add and personalise SVG symbols in QGIS (in French, Portail SIG)

Compare the "transport_bus_stop.svg" file where you can change the colors

enter image description here

In the file, the <path contains many parameters fill, fill_opacity, ...

<g><path fill="param(fill)" fill-opacity="param(fill-opacity)" stroke="param(outline)" stroke-opacity="param(outline-opacity)" stroke-width="param(outline-width)" d="M290.625,34.563c0.676,0,1.379,0.026,2.063,0.031
c0.688-0.005,1.381-0.031,2.063-0.031H290.625z"/>

And the "transport_bus_station.svg" file where you cannot change the colors, none of them.

enter image description here

<g><path d="M289.075,74.971c0.53,0,1.08,0.021,1.616,0.025c0.539-0.004,1.082-0.025,1.615-0.025H289.075z"/>

Therefore if you add these tags (fill=,...) after each "<path" and before d=" in the file:

<path fill="param(fill) #FFF" stroke="param(outline) #000" stroke-width="param(outline-width) 1"d="M289.075,74.971c0.53,0,1.08,0.021,1.616,0.025c0.539-0.004,1.082-0.025,1.615-0.025H289.075z"/>

The result is a symbol where you can change the color, the stroke and...

enter image description here enter image description here enter image description here

The new paths of the "transport_bus_station.svg" file

<g>
<path fill="param(fill) #FFF" stroke="param(outline) #000" stroke-width="param(outline-width) 1"d="M289.075,74.971c0.53,0,1.08,0.021,1.616,0.025c0.539-0.004,1.082-0.025,1.615-0.025H289.075z"/>
<path fill="param(fill) #FFF" stroke="param(outline) #000" stroke-width="param(outline-width) 1" d="M400.596,94.753c-21.278-8.867-72.277-19.462-109.904-19.758c-37.625,0.298-88.604,10.892-109.88,19.758
    c-21.582,8.993-35.975,17.989-40.471,40.47l-16.183,124.644v171.725h27.886v26.933c0,32.837,48.036,32.837,48.036,0v-26.933h88.727
    h0.27h92.228v26.933c0,32.837,48.062,32.837,48.062,0v-26.933h27.886V259.867l-16.183-124.644
    C436.57,112.743,422.178,103.746,400.596,94.753z M222.187,106.456h66.888h70.144c13.489,0,13.489,20.223,0,20.223h-70.291h-66.741
    C208.698,126.679,208.698,106.456,222.187,106.456z M176.085,377.754c-12.729,0-23.063-10.311-23.063-23.039
    s10.333-23.063,23.063-23.063s23.039,10.332,23.039,23.063S188.815,377.754,176.085,377.754z M289.075,272.99H166.806
    c-11.97,0-14.469-8.596-13.294-17.261l12.608-90.392c1.73-10.982,5.435-18.215,19.685-18.215h103.123h106.648
    c14.25,0,17.979,7.233,19.709,18.215l12.608,90.392c1.176,8.665-1.349,17.261-13.318,17.261H289.075z M405.321,377.754
    c-12.729,0-23.063-10.311-23.063-23.039s10.334-23.063,23.063-23.063c12.729,0,23.038,10.332,23.038,23.063
    S418.05,377.754,405.321,377.754z"/>
<path fill="param(fill) #FFF" stroke="param(outline) #000" stroke-width="param(outline-width) 1" d="M492.577,87.888C438.591,33.902,366.813,4.17,290.466,4.17S142.34,33.901,88.354,87.888
    C34.368,141.874,4.636,213.652,4.636,290c0,76.348,29.731,148.126,83.717,202.112c53.986,53.985,125.764,83.717,202.112,83.717
    c76.349,0,148.125-29.731,202.111-83.717c53.985-53.986,83.717-125.765,83.717-202.112
    C576.293,213.653,546.563,141.874,492.577,87.888z M290.466,550.692C146.72,550.692,29.774,433.746,29.774,290
    S146.72,29.308,290.466,29.308c143.745,0,260.691,116.946,260.691,260.692S434.211,550.692,290.466,550.692z"/>
</g>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.