It is a lie! A myth! It is not true! They don’t change to their surroundings! They change to give signals (such as their mood, or during mating etc…).
They have a layer of cells called chromatophores which lie just below their outer skin (which is see-through). These cells contain pigments (chemicals that have colour) which are yellow! Below these cells is another layer of cells which contain red pigments and then below them is another layer of cells with a blue pigment! And finally they have another layer of cells containing a brown pigment!
So there are 5 layers of cells 1) Clear 2) Yellow 3) Red 4) Blue and 5) Brown
These cells are all wired up to the nervous system of the chameleon. The colours are kept in little pockets inside the cells and signals from the nervous system can cause them to release the pigments from the pockets! And because there are different layers of cells (containing the 3 primary colours) they can almost make any colour! Fascinating! They don’t change to their surrounding though! They change based on their mood!
When it is calm it is green, when it is angry it might go yellow and when it wants to mate it will with on all the colours to do it is up for it!
Really hope that answers your question! If you want to know more then just ask! And please vote for me! I need all the votes I can get to keep doing more science with scientists like you! 😀