Set label font color using data defined property in PyQGIS 2 is well established, e.g. in another thread
However, PyQGIS 3 completely changed the way this works with no well documented examples. So, how to setup labels whose colors are based on data defined property. Here is my initial try, the label text show up, but the label's font color is not changing as i specified to be dependent upon the 'color' field values:
prop=QgsProperty()
prop.setField("Color")
pc=QgsPropertyCollection('mycol')
pc.setProperty(0,prop)
pal_layer=QgsPalLayerSettings()
pal_layer.setDataDefinedProperties(pc)
pal_layer.fieldName="value"
pal_layer.enabled=True
labeler=QgsVectorLayerSimpleLabeling(pal_layer)
layer.setLabeling(labeler)
layer.setLabelsEnabled(True)