The skin of the chameleon is transparent. Underneath this skin, there are layers of cells that contain yellow, black and red coloring matter. When these cells contract or expand, we see a change in the color of the chameleon.
But what makes those cells go to work? When the chameleon becomes angry or frightened, its nervous system sends a message to those cells. Anger causes the colors to darken; excitement and fright bring paler shades and yellow spots.
Sunlight also affects the chameleon's colors. Hot sunlight will make those cells turn dark, or almost black. High temperatures without sunlight usually produce green colors, low temperatures produce green colors. And darkness makes the chameleon fade to a cream color with yellow spots.
Many people believe nature gave the chameleon automatic color change for its skin so that it could resemble its background wherever it goes. But now you see that various things such as emotion, temperature and light cause the nervous system of the chameleon to make its color cells perform their tricks, and not the color of its surroundings.
It so happens, of course, that these changes in its color help the chameleon become almost invisible to its enemies, such as snakes or birds. And because the chameleon is such a slow-moving animal, it needs this kind of protection to save its life.