When a light ray passes from one medium to another at an angle, it refracts (or bends). The refraction of light at the interface is governed by Snell's law. White light is a combination of different colors in the visible spectrum, and different colors have different indexes of refraction. Thus, when the ray of white light passes through a prism, the colors refract at different angles.