There is a wide spread opinion that the chameleon changes its color according to its environment, turning itself invisible to its predators.
An individual able to shift its behavior in accordance with different persons is compared to a chameleon. But is that so?
Science does not confirm this idea at all.
Actually, the chameleon is constantly changing its color. Chameleons possess in chromatophores (cells that give skin's color) two types of pigments: one black (melanin) and another one, of various colors. Chromatophores retire or display their ramifications, changing this way their color.
Their movements are under the control of nerves or hormones (adrenaline secreted by the adrenal gland and hormones of the hypophysis). These colors respond perfectly to the needs of their arboreal life: 130 species of chameleons out of 156 live in trees. Colors displayed by the chameleons vary from gray to whitish, black, vivid green, green-yellow, olive or blue.
Adding to their natural colors their ability to stay still for minutes and their wagging and extremely slow movements (unusual for a lizard) that makes their laterally flattened bodies to look like a leaf or twig shaken by wind, we now understand why they may be inconspicuous for their predators.
Of course, they afford these slow movements, due to their hunting technique, based on their tongue, which is the longest in the world compared to the body length. The tongue is launched and put back in a fraction of second (0.04 s the launch (!), 0.5 s the put back).
The sticky tongue can catch from insects to even small birds in the largest species, than can be 70 cm (two feet) long. This effective hunting technique is also practiced by some newt species from Americas. The chameleon does change its color, but mostly for displaying its mood.
Chameleons are solitary and extremely territorial, rejecting even the company of other chameleons. If two chameleons meet face to face, they do all they can to impress each other, displaying menacing postures (wagging, jaw clacking, whistling, swelling of the body and the gizzard) and menacing colors! The defeated one will adopt a pale-gray color and will leave the territory.
In fact, if a chameleon is attacked by a predator, its color turns reddish with brown and yellow stripes, as their predators (snakes, mammals) do not distinguish colors well.
Color also signals changes in light and temperature in the environment. In the morning, after a fresh night, the chameleons will warm in the sun, flattening their flanks, which turn black.
If a leaf is put on the back of a chameleon and removed after a period, it will leave a color mark on its back, following its shape, due to the shifts in light and temperature. And the chameleons are not the only lizards than can change color: some iguanas, even called false chameleons, can do it exactly in the same manner.
As chameleons are somehow related to iguanas, it is plausible that the changing color ability developed in a remote ancestor, during the dinosaur era. Thus, being a chameleon won't hide your real feelings. There are in fact some other species that DO copy their environment, using chromatophores, like octopuses or many flatfishes, like flounders.
Photo below: A female Furcifer wilsii (Madagascar) chases away a male. The difference in color is just sexual dimorphism (females and males are differently colored).