Refactor code to change color of navigation bars