system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: why do oil slicks appear rainbow?
gpt
This is due to a phenomenon called "thin-film interference"

The oil layer is extremely thin, on the order of just a few wavelengths of visible light.  As the thickness varies, it moves between exact even and odd multiples of specific wavelengths (colors) of light, preferentially reflecting one specific color and absorbing or transmitting the rest.

This produces the rainbow effect.

Note that it only occurs in very thin films - spill the entire jug of motor oil and it goes away.