Here's how it works:
* Spectral class: Stars are classified based on their surface temperature, which is determined by the spectral lines (unique wavelengths of light) they emit.
* Letter assignment: Stars are categorized into seven main spectral classes, each with a distinct color:
* O: Blue (hottest)
* B: Blue-white
* A: White
* F: Yellow-white
* G: Yellow (like our Sun)
* K: Orange
* M: Red (coolest)
Important note: While the letter assignment is the most common way to classify stars by color, there are also subclasses within each letter (e.g., G0, G5, G8) that indicate finer temperature variations and corresponding color nuances.
So, while all stars in a specific spectral class share a dominant color, the exact shade can vary slightly within the class depending on the subclass.