How to change header color when on different pages

I am wondering, is it possible to make it so when you go to a different page on your website, the header changes color. Like on the home page the header is white but on the contact page, it’s red, etc.