As we look into the night sky, the stars seem very similar to each other in color, and the size of each dot in the sky is about the same. However, stars are really span a large range of sizes and temperatures. The differing temperatures of the stars give them different colors. For example, the bluish stars can be as hot as 25000K (45000F). Reddish stars are about 3000K (5000F). The sun is 5800K about (10000F). Kelvin is the absolute temperature scale, starting at -273C (-460F).
We measure the star temperature by analyzing the spectrum of its light. The classes of stars are known as spectral types.
The temperature and absolute brightness of a star are determined by the size of the star when it formed. The more mass in a star, the hotter and brighter it will be. This mass is mostly hydrogen, which the star converts to helium by nuclear fusion. Large stars use their hydrogen faster and therefore are hotter. They also last a much shorter time, because the hydrogen gets used up quicker. These stars last less than 1 billion years. Small stars use their hydrogen very slowly and are cooler and reddish. These are the red dwarfs, which are about 90% of all stars. They use their hydrogen so slowly that they are thought to last as long as the universe itself. They are so dim that they are invisible to the unaided eye. Our sun is a medium sized star, medium in temperature, and will last more than 10 billion years.