There has always been this popular myth about Chameleons changing their normal color to suit their environments, but this is very untrue. Chameleons do change their color, but they do so only as a way of signaling aggression, mood change, the urge to mate, and territorial dominance.
Chameleons do this in a molecular way; they are really molecular masterminds. Looking at the chameleon's skin, you will find several coatings specific cells known as chromatophores-cells that have the ability to change their colors. On the chameleon's outer skin, is a very transparent layer, below which you find the very first layer of cells that contain a large number of pigments. These are known as xantophores, which contain some specific pigments with yellow colors. Underneath that are pigment cells known as erythrophores with a red color. Underneath that, there is a second skin layer known as iridiphores with a blue-colored pigment known as guanine, which is also used for the production of DNA. Directly below that is a layer of cells called melanophores, which contain a brownish pigment known as melanin.
Now, how are chameleons able to change their skin colors? To begin with, the chromatophores are wired directly to the nervous system. They are equally receptive to certain chemicals that circulate throughout the blood stream of a chameleon. The major thing that takes place is that these colors are housed in the small vesicles: the small sacs contained in the cells that help keep them all in one particular place to make sure the cells do not appear colored. But as soon as a signal enters from the chameleon's blood stream or nervous system, the vesicles and granules can discharge, which allows the colors to circulate the entire cell, and this leads to a change in the color of the cell. This is much like adding a coat of paint to these cells. Varying comparative amount of action of diverse chromatophores in all the skin layers, it is much like mixing up different types of paints. For instance, mixing up yellow and red, the result of the mixture will be an orange color, this is exactly what these chameleons do. Chameleons mix up a variety of these chromatophores. This can be compared to what happens on your TV screen. When you mix up assorted colors on your TV screen to obtain the final color your eye sees and perceives, that is exactly the way the chameleon alters is color, and often does that as a way of conveying its mood.
Going by this, a very calm chameleon has a pale-green color. When it becomes angry, its color changes to bright yellow, and when it feels like mating, it can acquire any color is so desires to show it is in a mating mood. This is not a very unique characteristics of all chameleons. These chromatophores can also be found in other animals. Cuttlefish are some other very good examples of this process. So it has little or nothing to do with camouflaging. It has much more to do with communication techniques.