This phenomenon is called Dispersion of light.
In this the white light from sun, splits into its seven components. When white light passes through prism, different colours of light, constituting the white light, bend through different angles according to their wavelength.
The more the wavelength, the , the less will be the bending. So lights with higher wavelength(red) will bend the least and violate with lower wavelength will bend the most.
So the colours in the increasing order of deviation is:
R - red
O - orange
Y - yellow
G - green
B - blue
I - indigo
V - violet