We all thought we knew why chameleons change color, but most of us were probably wrong. Chameleons on today's Moment of Science.
Contrary to popular belief, it's actually a myth, that chameleons change colors as a response to the colors of their surroundings. Their ability to change colors is not about camouflaging themselves. Rather, their color changes in response to mood, temperature, and light. Their coloring is primarily a form of communication, such as whether or not they're willing to mate.
In other words, rather than changing color to look like something they're not, chameleons actually change color to reveal their true feelings. There's nothing deceptive about chameleons changing colors. The chameleon's skin is made up of a number of layers that serve different functions. The outer layer is transparent. Under that layer are two layers of red and yellow pigments. Under those are layers that reflect blue and white light, and below that are layers of brown melanin.
The cells in these various layers respond to internal chemical reactions, as well as to external light and heat, by expanding or contracting. For example, when a chameleon is calm it might look green in color because the contracted yellow pigment cells allow blue-reflected light to pass through. When a chameleon is angry the yellow pigment cells expand, thus preventing light from reflecting off of the layers of cells below.