How to set label color with setCustomProperty in QGIS2?

by mark78   Last Updated June 13, 2019 04:22 AM

I can set most font properties like this:

layer.setCustomProperty("labeling", "pal")
layer.setCustomProperty("labeling/enabled", "true")
layer.setCustomProperty("labeling/fontFamily", "Noto Sans")
layer.setCustomProperty("labeling/fontSize", "10")
layer.setCustomProperty("labeling/isExpression", True)
layer.setCustomProperty("labeling/fieldName", "title")    
layer.setCustomProperty("labeling/placement", "0")

But not font color. I've tried various ways of specifying the color:

layer.setCustomProperty("labeling/fontColor", "red")
layer.setCustomProperty("labeling/fontColor", "#ff0000")
layer.setCustomProperty("labeling/fontColor", QColor(255,0,0,255)

Surely there is a custom property for font color?

Tags : qgis pyqgis


Related Questions


Updated September 29, 2018 02:22 AM

Updated January 10, 2019 15:22 PM

Updated January 20, 2019 15:22 PM

Updated May 15, 2019 21:22 PM

Updated May 19, 2019 11:22 AM