Here's why:
* Blackbody Radiation: Stars radiate energy like blackbodies. Blackbody radiation is a spectrum of electromagnetic radiation emitted by an object based solely on its temperature.
* Wien's Displacement Law: This law states that the wavelength at which a blackbody emits the most radiation is inversely proportional to its temperature.
* Hotter stars emit more radiation at shorter wavelengths (blue and violet) making them appear blue.
* Cooler stars emit more radiation at longer wavelengths (red and orange) making them appear red.
So, the color of a star is a direct indicator of its surface temperature.
Here's a quick summary:
* Blue stars: Hottest (around 25,000 K or more)
* White stars: Very hot (around 10,000 K)
* Yellow stars: Moderate temperature (like our Sun, around 5,500 K)
* Orange stars: Cooler (around 3,500 K)
* Red stars: Coolest (around 3,000 K or less)