[Qgis-user] Extracting colours from a vector file

Alexei Schwab alexei at fastmail.net
Tue Apr 9 08:06:13 PDT 2024


Hi Grant,

Not sure if this is what you mean but if you want to get the colour of a feature's symbol you can use @symbol_color in the expression builder.

So adding a "colour" column to your attributes and using field calculator to set the expression to @symbol_color will give you the colour for each feature. 

It will give you a hex colour code. 

If you need the RGB values, you can use  the expression:

colour_part(@symbol_color, 'red'), colour_part(@symbol_color, 'green'), colour_part(@symbol_color, 'blue')

Regards,

Alexei

On Tue, 9 Apr 2024, at 08:54, Grant Boxer via QGIS-User wrote:
> I would like to extract colours from a rule-based rendered shp file with the aim of applying these colours to a MapInfo tab file. I have tried the rgb function but that doesn’t seem to work. Anyone have any suggestions to extract the red, green and blue values?
> Cheers Grant, Perth WA
>  
> _______________________________________________
> QGIS-User mailing list
> QGIS-User at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20240409/6ea49f32/attachment.htm>


More information about the QGIS-User mailing list