For years, many scientists assumed that the chameleon's ability to change colors came from its ability to move pigments around inside of its cells; however, it seems that this isn't the case at all. Instead of using pigments, the little animals rely on a lot of geometry and physics.
To understand this, you need to understand how light and our perception of color works.
Pigments, like the ones that we have in our own skin, generally operate by absorbing most colors of visible light except one. The one wavelength that is not absorbed is the color that we see. To break it down, this means that a purple pigment will absorb most of the wavelengths of visible light, and it will only allow the purple wavelengths to bounce off of its surface.
Chameleons, on the other hand, use structural color in order to present different appearances.
Structural color is a system that manipulates geometry on the nanoscale by forcing certain wavelengths of light to bend in specific ways. Scientists ultimately found two layers of skin with iridophores (these are the cells that utilize structural color). On the top layer, these were filled with tiny nanocrystals of guanine that are arranged into a lattice formation. On the chameleons, the formations have precise spacings between each crystal, and it is this spacing that allows the animals to give off different colors.
In the light spectrum, blues are located on the short end while red colors are on the long end. As a result, when the guanine crystals have short spaces between them, they reflect the bluer wavelengths. When the crystals are spaced farther apart, they reflect the longer wavelengths. These factors are combined with pigment cells in order for the chameleons to change their appearance.
The scientists were able to determine this by analyzing the animals nanoscale structure using transmission electron microscopy.
Learn more in the video below: