The color changes chameleons experience are a result of the pigment-filled sacs found within the various layers of chromatophores that exist beneath the reptile's transparent outer skin layer. The sacs at the topmost level are filled with xanthophores that contain yellow pigments and erythrophores that contain red pigments. The next layer contains blue-pigment cells called iridophores. The bottom layer is filled with melanophores that contain brown melanin.
The pigments remain dormant within the sacs until the chameleon's nervous system reacts to changes in mood or environment that cause certain chromatophore layers to expand or contract. Although many believe that chameleons change colors to blend in with the objects that surround them, the colors actually reflect a change in mood or body temperature.
The ability to match the color that surrounds it allows the chameleon, which is cold-blooded, to regulate its body temperature. The chameleon changes to a darker shade to absorb heat and a lighter shade to reflect heat.
The chameleon also uses color to portray a change in mood as a signal to other chameleons. A female chameleon changes its color to signal a male chameleon for mating. To assert their dominance, male chameleons change to a brighter shade. Male chameleons darken during aggressive encounters.