A prism is a transparent medium bounded by any number of surfaces in such a way that the surface on which light is incident and the surface from which light emerges are plane and non-parallel. Generally equilateral, right angled isosceles or right angled prisms are used.
When white light or sun light passes through a prism, it splits up into constituent colours. This phenomenon is called dispersion and arises due to the fact that refractive index of prism is different for different colours of light.
So, different colours in passing through a prism are deviated through different angles. The frequency of colours in decreasing order is violet, indigo, blue, green, yellow, orange, and red. It can be written as VIBGYOR.
Rainbow, the most colourful phenomenon in nature, is primarily due to the dispersion of sunlight by rain drops suspended in air.