Although in the night sky we see them all more or less the same, the truth is that the stars can present a certain range of colors. You may have heard of blue giant stars, white dwarfs, or red supergiants . This is not an abstract way to classify them, but that description refers to the actual color of each of those stars. This color is due solely to the temperature of the star. At its surface temperature, specifically. Stars emit light just like a blackbody would. This body, which of course has nothing to do with the color of human skin, would be an ideal emitter, emitting light simply by being at a certain temperature.
All bodies, being at a certain temperature, emit electromagnetic radiation , that is, light. From the Sun or an incandescent light bulb to you. The difference between you and the Sun, the reason you don’t shine, is that the light you emit is in the infrared part of the spectrum . That is, you do shine, you do emit light, but our eyes are not able to see it with the naked eye. A body that absorbs all the light that reaches it and only emits light because it is at a certain temperature will be known as a black body. This is an idealization because although black objects absorb most of the light they receive, there are none that absorb all of it.
The light that we are able to see represents a tiny fraction of all possible wavelengths . Infrared from night vision cameras, X-rays from X-rays or microwaves from microwave ovens are light, exactly like what your eyes perceive, allowing you to see the world around you. They only differ in their energy. You may know that when a sound becomes too low or too high, we can no longer hear it. The same thing happens with light: when it becomes less energetic than red light, that is, infrared, or more energetic than violet, ultraviolet light, we stop seeing it. This is what is known as the electromagnetic spectrum or spectrum of light . The visible part of this spectrum would be made up of the colors we know, those that make up the rainbow.
At the end of the 19th century, it was determined how the energy emitted by a black body is distributed. There will be a wavelength with maximum emission that will decrease with increasing temperature . Put more simply, this means that hotter bodies emit increasingly bluish light . That is why a piece of metal, when heated, begins to glow with a reddish hue and changes to orange, yellowish and white as it heats up. Also the stars will follow this pattern. The cooler ones will have a reddish or orange glow. Betelgeuse, a star found in the Orion constellation, forming the left shoulder of the mythical warrior, or Aldebaran, the brightest star in Taurus and one of the brightest in the night sky, are eminently red. Both can be easily seen on a clear night from the outskirts of any city. The surface temperature of these stars is around 3,000 to 4,000°C . Stars like our Sun or Alpha Centauri (the closest star visible to the naked eye to the Solar System and the second closest) show a yellowish glow, with their surface around 5000 or 6000 ºC . The hottest stars, such as Rigel (also in the constellation of Orion, in the right corner of the skirt worn by the warrior) or Sirius, shine with a bluish hue and their surface temperature exceeds 10,000 ºC . In fact Sirius, the brightest star in the night sky, consists of a system of two stars very close to each other and orbiting each other. The largest and brightest star has a temperature of almost 10,000 ºC, while its companion reaches 25,000 ºC.
But the radiation of the black body not only allows us to understand the color of the stars but also the color of the flame of a lighter or the stove in a kitchen. When we light the flame, the lower part usually has a bluish tone and as we go up it takes on yellow and orange tones. Well, what we have discussed for the stars can be transferred here, reducing the temperature scale a bit. In this way the blue part of the flame will be the hottest . When the gas mixes with the gases of the atmosphere, the combustion will be less efficient and the flame will lose temperature, changing its color accordingly.
Of course, we should not assume that all light emitted will follow this principle. In LED bulbs, fluorescent tubes or on telephone and television screens, the emission of light will not follow the behavior of a black body, but will come from the interaction of a certain electric current with the electrons of the specific bulb or pixel. In these cases we will not be able to establish a relationship between the color of the light and the temperature of the object that emits it .