Sunlight is made up of a mixture of red, orange, yellow, green, blue, violet and indigo. These colours are the same as that of a rainbow. A prism can be used to see all the colours of the sun. When light passes through a prism, it bends. Each colour can be seen at a different angle. Violet bends the most, while red bends the least.
We assume sunlight to be white in colour. This is because when all the colours are mixed up, it looks white.
Light refracts, or bends, when it passes from one medium to another. Every colour of sunlight has a different wavelength. When sunlight passes through a prism, the light separates into its constituent colours with the shorter wavelengths refracting at greater angles than the longer wavelengths. Since violet light has the shortest wavelength, it bends the most; red light has the longest wavelength, so it bends the least.