1

I am trying to make the color of my buffer totally transparent, but I want to keep the stroke fully colored.

I tried the following :

color1 = QtGui.QColor('#f3a6b2') #or whatever, as it will be transparent
color2 = QtGui.QColor('#ffffff')
symbo = QgsSimpleFillSymbolLayer(color = color1, strokeColor = color2, strokeWidth = 1.26)
buffer_loc.setOpacity(0)
buffer_loc.renderer().symbol().changeSymbolLayer(0, symbo)
buffer_loc.triggerRepaint()

But the opacity applies to the whole polygon, including the stroke. Any tips ? I only found answers regarding rasters but nothing for vector layers so far...

2
  • usually you would set the brush to null rather than use transparancy
    – Ian Turton
    Commented Jun 8, 2021 at 9:14
  • @IanTurton Oh see I didn't think of it, thank you!
    – cam_gis
    Commented Jun 8, 2021 at 9:45

0

Your Answer

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