ROYGBIV. Isaac Newton used a glass prism to refract white sunlight into a spectrum with all the colors of the rainbow. Newton knew the color gradations were continuous; nonetheless, he postulated that there are seven primary colors, which he called red, orange, yellow, green, blue, indigo, and violet or purple (ROYGBIV).
Why did Newton say there are seven primary colors? Modern color models have only three primary colors and three secondary colors. One reason is that Newton theorized that seven primary colors would be "proportional to the seven musical tones or intervals of the eight sounds, sol, la, fa, sol, la, mi, fa, sol" [Opticks]. This charming theory was misguided. Today, there is no rationale for saying there are seven primary colors.
Why did Newton say indigo, a color between blue and violet, was a primary color? Modern color models do not have a primary or secondary color between blue and violet. One possible reason is that, in a spectrum projected by a prism (not a diffraction grating), the blue/violet end of the spectrum is wider than the red/orange/yellow end of the spectrum, so there appears to be room for another primary color between blue and violet. But a better explanation is that the meaning of the words "indigo" and "blue" have changed since Newton's time (the 1600s). Newton's "indigo" is roughly the color we would call "blue" or "dark blue" and Newton's "blue" (or "blew") is roughly the color we would call "cyan" or "blue green" or "light blue". So, Newton's seven colors would better be described in modern terms as red, orange, yellow, green, cyan, blue, and violet (ROYGCBV).
Experiment. If you have normal color vision and a prism, you can easily do an experiment to see for yourself Newton's seven primary colors. First, print Newton's black-and-white prismatic colors diagram (below) on white paper.
Then, use a prism (not a diffraction grating) to project a spectrum of bright rainbow colors directly onto Newton's diagram (as in my photo above). Position the prism and the diagram to make the colors red, orange, yellow, and green align with the segments that Newton labeled with those color names. Then you can see for yourself what colors appear in the segments that Newton called blue, indigo, and violet or purple. When I do this, Newton's "blue" appears to be the color I would call "cyan" and Newton's "indigo" appears to be the color I would call "blue". Photos, displayed on screens or printed on paper, do not accurately reproduce the fully saturated spectral colors, so you should get a prism and do the experiment for yourself.
Here are some ways to improve the experiment. Project the spectrum in a darkened room or box with direct sunlight entering through a single opening. Glass, clear plastic, and optical coatings may alter the colors, so eliminate all layers of glass or clear plastic other than the prism. Open the window. Remove your eyeglasses. The paper or projection surface should be white but preferably without fluorescent whiteners, which may alter the colors. White paper now often contains fluorescent whiteners. If your paper glows blue under an ultraviolet light, it contains fluorescent whiteners.
Modern color models. We now know that a rainbow spectrum has light of all visible (and some invisible) frequencies, so the color gradations are continuous, without any colors being primary. However, we now understand human color perception in terms of the mixing of three primary colors. The underlying reason for saying there are three primary colors is that the human retina normally has exactly three types of color photoreceptor cells. The common modern color models, RGB (light), CMYK (printing), and RYB (traditional), each have three primary colors. The three primary colors may be mixed in pairs to make three secondary colors, often shown as a color wheel with six colors.
Note: Magenta and purple are a mixture of red and blue or violet. They are in the color wheel but not in the rainbow.