I want to change Color rendering of the XYZ tile(namely google satellite). In case of raster image we can easily convert using following code.
layer = iface.activeLayer()
myGrayRenderer = QgsSingleBandGrayRenderer(layer.dataProvider(),1)
layer.setRenderer(myGrayRenderer)
But this does not seems work with XYZ tile.