For years, science told us that chameleons changed color to communicate with each other and to help thermoregulate. Changing coloration to blend in was said to be a myth.
Then it was discovered that chameleons not only change coloration to blend in with their surroundings, but they do so according to the type of predator they are observing at the time. One coloration works better for concealment if the chameleon is hiding from birds, another coloration works better against snakes.
Here is a link to the study: