How do I change material render preview? I want to change the render material preview by removing the floor in the preview and replacing all the lighting and environment in it with an hdri image, and setting an image as a background, so that the render preview changes from this:

To this:

I also want the material shown in the preview to look the same in Blender's file browser when I use append, like this:

So how do I do all this?
I do not mind using programming with Python if there is no other than this solution.
Had the same question found your then just worked it out by pick things.
Top right hand corner of the 3D viewport there is a drop down arrow.
In viewport shading you can select scene lights and scene world.
I didn't try to see if this would give you the result your looking for but it has worked for me.
Regards