Here's how it works:
* Light and Temperature: Every object in the universe emits light, and the color of that light depends on its temperature. Hotter objects emit more blue light, while cooler objects emit more red light.
* Spectral Lines: Stars emit light across a wide range of wavelengths, but they also absorb light at specific wavelengths. These absorption lines are like "fingerprints" that reveal the chemical composition and temperature of the star's outer layers.
* Classification: Astronomers have categorized stars based on their spectral lines, creating a system of spectral types: O, B, A, F, G, K, and M. O stars are the hottest and bluest, while M stars are the coolest and reddest.
So, the spectral type of a star essentially tells us how hot its surface is, giving us a key piece of information about its overall properties.