Unlike other animals that change colour, 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.
Researchers found that chameleons have two superposed thick layers of iridophore cells - iridescent cells that have pigment and reflect light.
The iridophore cells contain nanocrystals of different sizes, shapes and organisations, which are key to the chameleons' dramatic colour shifts, the researchers said.
More From This Section
"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.
When the skin becomes excited, the distance between neighbouring nanocrystals increases, and each iridophore cell selectively reflects longer wavelengths, such as yellow, orange or red, Milinkovitch told 'Live Science'.
The "red skin hue does not change dramatically during excitation, but its brightness increases," the researchers said.
The researchers also manipulated the iridophore 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 colours.
Only adult male chameleons change colour, especially when they see a rival male chameleon they want to chase away, or a female to attract, Milinkovitch said.
The study is published in the journal Nature Communications.