When sunlight is incident on a prism, it produces a spectrum due to refraction of light Refraction is the change in direction of a wave due to a change in its velocity. Glass has a higher refractive index than air and the different frequencies of light travel at different speeds (dispersion), causing them to be refracted at different angles. The different frequencies correspond to different colours observed.