While the meaning of the colors has changed over time , these three colors were adopted by Mexico following independence from Spain during the country 's War of Independence . While the meaning of the colors has changed over time , these three colors were adopted by Mexico following independence from Spain during the country 's War of Independence , and subsequent First Mexican Empire .