[QGIS-Developer] SVG toolbar icons suddenly appearing in black

Charles Dixon-Paver charles at kartoza.com
Thu Sep 23 03:29:13 PDT 2021


Hi Raymond,

I am on Windows with 3.20 and the icons are blue for me.

I opened the SVG in inkscape and saved an "optimized svg", which runs
scours against it, and all that changed is the <?xml version="1.0"
encoding="UTF-8"?> definition was added and version="1.1" was injected into
the svg tag.

One oddity though, is that when I changed the feature colour and saved it,
the "bright" svg version retained the <style>.a {fill: #1b3d6e;}</style>
data element, but the *path* tag got a fill="#00f" added into it. I imagine
QGIS is recognising the CSS (for me) but giving preference to the fill
attribute.

Still, all icons are blue for me...

[image: image.png]

It could also be a contrast issue on the users screens changing, where the
blue icon is simply appearing black, but I imagine most likely the system
is not recognizing that css style in the svg.

I hope that helps you.


On Thu, 23 Sept 2021 at 11:26, Raymond Nijssen <r.nijssen at terglobo.nl>
wrote:

> Hi devs!
>
> The dark blue icons on my plugin toolbar buttons are black for some of
> my customers (on Windows). One of them mentioned that they turned black
> after a QGIS update. On my Linux system they are still blue. I guess it
> has to do with Qt.
>
>
>
> Here's the content of the svg file:
>
> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
>    <defs>
>      <style>
>        .a {
>          fill: #1b3d6e;
>        }
>      </style>
>    </defs>
>    <path class="a"
>
> d="M15.52,6.54a7.29,7.29,0,0,0-1.77,7.38l-9.9,9.9-.34,4.33,5.94-.6v-2.8h2.8V22h2.8l3.37-3.36a7.26,7.26,0,1,0-2.9-12Zm5.37,2.1a2,2,0,1,1,0,2.81A2,2,0,0,1,20.89,8.64Z"/>
> </svg>
>
>
>
> And here's how I make the buttons:
>
> icon_fn = os.path.join(self.plugin_dir, 'img', 'icon_configuration.svg')
> icon = QIcon(icon_fn)
> action = QAction(icon, 'Configure', self.iface.mainWindow())
> self.toolbar.addAction(action)
>
>
>
>
> Hope anyone can clarify. The svg files were made by a designer, I guess
> in some Adobe application. Hope I don't need adjusting them.
>
> Kind regards,
> Raymond
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210923/72005ba1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 2621 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210923/72005ba1/attachment.png>


More information about the QGIS-Developer mailing list