Further to the question Assigning raster layer colors to polygons in QGIS, I have used the expression proposed by @Babel solution with a positive result.
Is it possible to use a similar expression for the colour parameter with the Field calc, so that it works with a polygon layer and extracts the average colour value of all the pixels that are within each polygon?