The science of spectroscopy paves the way for the classification of stars according to their spectral types, or the result of their specific spectra. You can tell a lot by breaking down a star’s light.
In order to understand spectral types, let us go a little into the science of spectroscopy, or breaking down a star’s light into its components. This is done through a spectrometer which passes light from the star to a slit and then breaks it down into its spectrum. Our own sun’s spectrum is visible whenever we look at a rainbow.
Knowing the star’s spectrum opens a lot of different possibilities. From here, you can know its composition, movement and even its surface temperature.
Once the star’s spectrum has been determined, it can then be classified into the different spectral types of different stars. One classification of spectral types is according to surface temperature of the star under observation. These temperatures correspond to the color of the star as we observe them. If you will notice on a starry night, the stars have different colors.
Just like their colors, these stars are called blue, blue-white, white, yellow, yellow-orange, orange giants, and red stars. The blues have the higher surface temperature while the reds have the lower surface temperature. Our own Sun is classified as a yellow star.
Since you cannot just rely on the observed color as seen by your naked eye, it would still be better to use the spectrum obtained to classify the star according to its spectral type.