The chameleon's uncanny ability to change color has long mystified people, but now the lizard's secret is out: Chameleons can rapidly change color by adjusting a layer of special cells nestled within their skin, a new study finds.

Unlike other animals that change color, such as the squid and octopus, chameleons do not modify their hues by accumulating or dispersing pigments within their skin cells, the researchers found. Instead, the lizards rely on structural changes that affect how light reflects off their skin, the researchers said.

To investigate how the reptiles change color, researchers studied five adult male, four adult female and four juvenile panther chameleons (Furcifer pardalis), a type of lizard that lives in Madagascar. The scientists found that the chameleons had two superposed thick layers of iridophore cells — iridescent cells that have pigment and reflect light. [See photos of color-changing chameleons]

The iridophore cells contain nanocrystalsof different sizes, shapes and organizations, which are key to the chameleons' dramatic color shifts, the researchers said. The chameleons can change the structural arrangement of the upper cell layer by relaxing or exciting the skin, which leads to a change in color, they found. For instance, a male chameleon might be in a relaxed state when it's hanging out on a branch, and in an excited state when it sees a rival male.

"When the skin is in the relaxed state, the nanocrystals in the iridophore cells are very close to each other — hence, the cells specifically reflect short wavelengths, such as blue," said study senior author Michel Milinkovitch, a professor of genetics and evolution at the University of Geneva in Switzerland.

On the other hand, when the skin becomes excited, the distance between neighboring nanocrystals increases, and each iridophore cell (which contains these nanocrystals) selectively reflects longer wavelengths, such as yellow, orange or red, Milinkovitch told Live Science in an email.But chameleons aren't always blue. The lizards' skin also contains yellow pigments, and blue mixed with yellow makes green, a "cryptic" color that camouflages them among trees and plants, Milinkovitch said.

This male chameleon changed color, from green to yellow. Its red markings also became more vibrant.
This male chameleon changed color, from green to yellow. Its red markings also became more vibrant.
Credit: Michel Milinkovitch

The "red skin hue does not change dramatically during excitation, but its brightness increases," the researchers wrote in the study.

Furthermore, the researchers found a deeper and thicker layer of skin cells that reflect a large amount of near-infrared sunlight. While these cells do not appear to change color, it's possible that they help the chameleons reflect heat and stay cool, the researchers said.

The researchers used a number of methods to study the iridophore cells. They filmed the chameleons' color changes using high-resolution videography and made numerical models that predict how the nanocrystals should reflect light.

"The results are a perfect match with what we observe [in real life]," Milinkovitch said.

The researchers also manipulated the cells by subjecting them to solutions of varying concentrations, which caused the cells to swell or shrink. These modifications changed the distances between the nanocrystals, and altered their visible colors, just as the researchers predicted they would, Milinkovitch said.

However, only adult male chameleons change color, especially when they see a rival male chameleon they want to chase away, or a female to attract, Milinkovitch said. Females and young chameleons are dull-colored and have a very reduced upper layer of iridophore cells, he said.

The findings may help engineers and physicists replicate the chameleon's color-changing capacities in new technology, such as appliances that eliminate reflection, Milinkovitch said.

The study was published online today (March 10) in the journal Nature Communications.

Follow Laura Geggel on Twitter @LauraGeggel. Follow Live Science @livescience, Facebook & Google+. Original article on Live Science.