Change the background color of navigation bars

This tutorial shows how to add background color to a navigation bar. Some navigation bars already have background color depending on their style and some do not. When a navigation bar is added to a sticky header as show in this tutorial (Pin elements at the top of a page), background color may be needed if that navigation bar do not have other element below it or it is the only element in the sticky header.