However, 'colors' of stars is not accurate enough. Modern astronomers use spectra. Late in the 19th century, it was realized that the spectra of stars (in particular, their patterns of absorption lines) had systematic features.
At first, astronomers identified a number of stars which showed a very STRONG pattern of lines, called the Balmer Lines. (due to Hydrogen). They were called 'A' Stars. Stars with slightly weaker Balmer lines of Hydrogen, were called 'B' Stars and so on. At one point, the letters labeling all these different looking stellar spectra went all the way to 'S'.
Annie J. Cannon, an assistant at the Harvard Observatory beginning in 1896, realized that there were only 7 unique kinds of stars (OBAFGKM). All other LETTERS were dropped. Ms. Cannon classified more than a quarter million stars which were published as The Draper Catalogue in nine volumes, from 1918 to 1924.