The outermost layer of the chameleon’s skin is transparent. Beneath this are several more layers of skin that contain specialized cells called chromatophores. The chromatophores at each level are filled with sacs of different kinds of pigment. The deepest layer contains melanophores, which are filled with brown melanin (the same pigment that gives human skin its many shades). Atop that layer are cells called iridophores, which have a blue pigment that reflects blue and white light. Layered on top of those cells are the xanthophores and erythrophores, which contain yellow and red pigments, respectively.
Some chameleons change colors to help their bodies adjust to changes in temperature or light. For example, a chameleon that gets cold might change to a darker color to absorb more heat and warm its body.