Why do stars have different colors
Stars appear to have different colors based on the temperature of their surface. The temperature of the surface of stars depends on many factors like their size and their age. Stars at a lower temperature radiate their energy in the infrared and red region of the electromagnetic spectrum. This makes them appear red in color. Hot stars radiate in the ultraviolet and blue region of the electromagnetic spectrum. This makes them appear blue or white in color.
Astronomers can estimate the temperatures of stars by measuring the frequency of the radiation from the stars. Our sun has a surface temperature of 5800 K.