The color of stars
Most of the stars that you see in the sky are stars of our own galaxy. You can see that some are more yelow, some bluish, some reddish… But why do they have a color? Well, we first have to understand why material objects have color.
A rose is red because, if you illuminate it with some white light (which means some light with all the shades of the rainbow), it only reflects the red component.
A white rose reflects all colors, hence looks white.
A black object looks black because it absorbs all colors of light and reflects none.
If the surface of Mars looks red, it is because, illuminated by the light of the Sun, it only reflects red light.
But what makes the color of the Sun? What makes the color of stars?
The light that comes from them cannot be reflected by their surface, because there is no light source close by; this light must be emitted by themselves. Indeed, if you were sending some light beam to the surface of the Sun, it would be absorbed by this surface. In other words, the surface of the Sun -and of all stars for that matter- is a black body, in the sense that it is a perfect absorber of light. But why do we see colors?
Well, it was discovered at the end of the XIXth century that a heated black body emits electromagnetic radiation (light if you prefer), and the color of this light is characteristic of its temperature.
Somehow, you know this: take a piece of charcoal, it is black,; heat it: it will become red or even white; it thus emits a light which is characteristic of its temperature.
Similarly, the color of the light emitted by stars gives us precious information about the temperature of the star interior.
As for explaining this strange phenomenon called black body radiation, one had to wait till Max Planck in 1900. This was the birth of quantum mechanics…