When a ray of light passes from one medium to another medium, it gets deviated from its path because of the difference in speeds of light in the two media.
Newton allowed the white light from the Sun to enter a darkened room through a small aperture in a window and placed a glass prism in the path of light rays and found light emerging with the colours of a rainbow. This coloured band is termed a spectrum.
Starting from the side of the base of the prism, the colours in the spectrum on the screen are in the following order: Violet, Indigo, Blue, Green, Yellow, Orange and Red. The order of colours can easily be remembered as VIBGYOR.