Rainbows are formed when sunlight falling on raindrops is split into the different colours of the spectrum (range) of light. Sunlight is really a mixture of all the colours of the spectrum: red, orange, yellow, green, blue, indigo and violet, but our eyes always see them as ordinary white light.

               When a beam of light passes at an angle through a curved transparent surface, such as a raindrop, the beam is bent when it emerges. The different colours of light are bent by different amounts, so the white light is split into the colours of the spectrum. This effect can also be seen when light passes through a piece of glass cut at different angles, such as a prism.

Picture credit: google