For a long time it was thought that chameleons change color by dispersion of pigment-containing organelles within their skin. However, research conducted in 2014 on panther chameleons has shown that pigment movement only represents part of the story.
Chameleons have two superimposed layers within their skin that control their color and thermoregulation. The top layer contains a lattice of guanine nanocrystals, and by exciting this lattice the spacing between the nanocrystals can be manipulated, which in turn affects which wavelengths of light are reflected and which are absorbed. Exciting the lattice increases the distance between the nanocrystals, and the skin reflects longer wavelengths of light. Thus, in a relaxed state the crystals reflect blue and green, but in an excited state the longer wavelengths such as yellow, orange, green, and red are reflected.
The skin of a chameleon also contains some yellow pigments, which combined with the blue reflected by a relaxed crystal lattice results in the characteristic green color which is common of many chameleons in their relaxed state. The deeper layer of skins works in a similar fashion but primarily controls the amount of near-infrared light that is absorbed or reflected, and therefore may influence thermoregulation.