how would I change background color of a theme using a plugin?

If the theme uses the custom-background functionality of WordPress, then WordPress outputs CSS code in the head which essentially says body.custom-background { ... } and it puts the chosen colors and image in there.

So most themes sorta expect that to be on the body itself, and to have a custom-background class on the body tag.