Making background solid color
This is less flexible than compositing, but if you're in Cycles, and lazy, you can, for example:

Split your world material into a mix between 2 colors, one to light the scene, and one to be visible to the camera. Here the scene is lit only by an environment HDRI, with its color tweaked though a Hue Saturation Value node.
Sit your object on a plane masked in its 'Object' tab &gt; 'Visibility' panel to be a shadow catcher:

For this kind of result..

There are quite a few possible approaches .. maybe 'Shadow Catcher' would be a fruitful search term.