The different colours of different stars are due to the variation of
(1) temperature
(2) pressure
(3) density
(4) radiation from them
Answer: (1). Shortly after blackbody radiation was understood, it was noticed that the spectra of stars look extremely similar to blackbody radiation curves of various temperatures, ranging from a few thousand Kelvin to ~50,000 Kelvin. The obvious conclusion is that stars are similar to black bodies and that the colour variation of stars is a direct consequence of their surface temperatures.