text: White light separates into different colours when it goes from air into oil, because red light is  refracted by a lesser angle than blue light. The same happens when light goes again out of the oil into the air.\n\nSpilt oil spreads out in multiple layers only a few molecules thick. When light falls upon it, part of it will be deflected on the top of the oil, directly into your eye. But a large part of the light will go into the oil, scatter back on one of the deeper layers and out again. This part will be spread out and produce a rainbow. \n\nNormally this effect is very tiny and you don't notice it for instance with spilt water where there are no layers. But with oil the effect is enhanced because the light rays can follow multiple paths inside the oil, scattering several times up and down on different layers, before coming out in the air again.