Chameleons change their color through specialized cells called chromatophores that contain pigment. These cells are controlled by the chameleon's nervous system and can expand or contract to reveal different colors such as green, brown, yellow, or even red. The change in color is a response to factors like temperature, light, mood, and communication with other chameleons.