There are seven colors in a rainbow: red, orange, yellow, green, blue, indigo and violet. The acronym ROYGBIV, pronounced "Roy G. Biv," is a popular mnemonic to remember the colors in order.
A rainbow is formed when white light, such as sunlight, is bent through a prism or through water droplets suspended in the air. The prism or water causes light to separate by wavelength, because light of longer wavelengths such as indigo and violet bends more than light of shorter wavelengths. If a rainbow is passed through a second prism, the separated light can be re-combined into white light.
Sometimes the different colors blend with each other, making it difficult to see each color independently. Red is created when the angle difference between the sunlight entering and exiting is 42 degrees, a 40 degree difference produces purple, and so on.