Isaac Newton performed a famous experiment using a triangular block of glass called a prism. He used sunlight shining in through his window to create a spectrum of colours on the opposite side of his room.
This experiment showed that white light is actually made of all the colours of the rainbow. These seven colours are remembered by the acronym ROY G BIV – red, orange, yellow, green, blue, indigo and violet.
When white light shines through a prism, each colour refracts at a slightly different angle. Violet light refracts slightly more than red light. A prism can be used to show the seven colours of the spectrum that make up white light.
Newton showed that each of these colours cannot be turned into other colours. He also showed that they can be recombined to make white light again.
The explanation for the colours separating out is that the light is made of waves. Red light has a longer wavelength than violet light. The refractive index for red light in glass is slightly different than for violet light. Violet light slows down even more than red light, so it is refracted at a slightly greater angle.
The refractive index of red light in glass is 1.513. The refractive index of violet light is 1.532. This slight difference is enough for the shorter wavelengths of light to be refracted more.