Scientists may have finally unlocked the mystery behind chameleons’ unique ability to change color.

The explanation is that the reptile’s skin is made up of tiny mirror-like crystals, contained within reflective pigment cells called iridophores. That’s according to a new study published in the journal Nature Communications.

When the chameleon gets excited, or anticipates danger, the iridophores expand or contract to enable the crystals to reflect different levels of light, thereby changing its skin color.

Get The Brief. Sign up to receive the top stories you need to know right now. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

The researchers used a combination of microscopy, high-resolution videography and color-based numerical modeling to arrive at this discovery.

“When the skin is in the relaxed state, the nanocrystals in the iridophore cells are very close to each other — hence, the cells specifically reflect short wavelengths, such as blue,” Michel Milinkovitch, a professor of genetics and evolution at the University of Geneva in Switzerland and the lead author of the study, told Live Science.

Milinkovitch further explained that, when excited, the nanocrystals spread further apart to reflect longer wavelengths like yellow, red and orange, which combine with blue to produce different hues.

If any of those hues is white, gold, black, or blue, we might just have chameleons breaking the Internet soon.

Read next: The Weird Reason Humans Shake Hands as a Greeting

Listen to the most important stories of the day.

Write to Rishi Iyengar at rishi.iyengar@timeasia.com.