Here's how it works:
* Hotter stars emit more blue light: Stars with very high surface temperatures emit most of their light in the blue and ultraviolet parts of the spectrum, making them appear bluish-white.
* Cooler stars emit more red light: Stars with lower surface temperatures emit most of their light in the red and infrared parts of the spectrum, making them appear reddish.
* Intermediate temperatures: Stars with intermediate temperatures emit a mix of colors, making them appear yellow, orange, or white.
Therefore, a star's color is a direct indicator of how hot its surface is.