Science and nature reporter, BBC News
Chameleons first used colour change to make them more noticeable rather than, as is popularly believed, to blend in, a study suggests.
The reptiles change colour for a variety of purposes - communication, camouflage and temperature control.
However, the reason why they first evolved this ability to flash bright colours was previously unclear.
Scientists report in the journal Plos Biology that it was to allow them to signal to other chameleons.
Co-author Dr Devi Stuart-Fox, from The University of Melbourne, Australia, told BBC News: "[Our research] suggests that chameleons evolved colour change for signalling, to fend off rivals or attract a mate, and not so they could match a greater variety of backgrounds."
What chameleons see
Dr Stuart-Fox's team looked at the colour changing ability of 21 southern African dwarf chameleon species (Bradypodion spp), to compare species colour changing ability and consider evolutionary relationships.
As chameleons have a different visual system to humans, they have a fourth type of cone which is ultra-violet (UV) sensitive, the researchers had to first measure what the chameleons were actually seeing.
The Melbourne-based researcher explained: "We measured colour with a spectrometer, which measures both the UV and visual colour range, and combined this with information on the chameleon visual system to model chameleon colour perception."
Colour change is rapid (milliseconds or seconds) as under direct neural control
Its eyes can move independently
It can see in two different directions at once
Its tongue is twice as long as its body
By setting individual chameleons up in a duel with a series of opponents, the colour range between the submissive and dominant colours could be measured.
"If a male is challenged by another male they both begin by showing their brightest colours - until one figures out the other is going to win and changes to a submissive, dark, 'don't beat me up colour'," said Dr Stuart-Fox.
The team also looked at how chameleons change colour in response to a predator, by presenting them with a model bird or snake.
It was shown that the most dramatic colour changes were used to socially signal to other chameleons.
"We found that chameleon species that changed colour the most had displays that were most conspicuous to other chameleons. But they didn't have a greater range of background colours in their habitats," said Dr Stuart-Fox.