Quick answer,
You might want to have a look to
https://qgis.org/api/classQgsProcessingUtils.html#aa1c2360e52d2ed8100faf02a35125b17
I'm not sure about writing a processing script with this syntax, I'm still
using the class way. But you might want to set your style in a post
processor
I'm writing a Python script to load a "qml" style file. The following
two lines work correctly:
lyr1 = iface.activeLayer()
lyr1.loadNamedStyle('xxx.qml')
but the following two lines cause an error message:
lyr2 = instance.parameterAsSource(parameters, "INPUT", context)