The temperature of a star refers to its surface and that is what determines its color. The lowest temperature stars are red while the hottest stars are blue.
Astronomers are able to measure the temperatures of the surfaces of stars by comparing their spectra to the spectrum of a black body. A black body is one that entirely absorbs all radiation that strikes it. Astronomers determine the black body spectrum which most closely matches the spectrum of the star in question. Because the temperature of the matching black body is known, astronomers can then calculate the star's surface temperature.
Astronomers classify stars into different types depending on their temperatures. These types are O, B, A, F, G, K, and M, where type O stars are the hottest and type M stars are the coolest. Each of these types is divided further into sub-divisions from 0 to 9 in order to distinguish between slight differences in each star's spectral patterns, which depend on the star's temperature.
Our Sun is a Type G star, which are yellow stars with surface temperatures of about 6000 °C, or 11,000 °F. Type A stars, which are hotter, are white in color and maintain temperatures of around 10,000 °C or 18,000 °F. The hottest of the types, B and O, are blue stars while the coolest of type M is red in color and have surface temperatures of about 3,000 °C or 5,400 °F.
Note that we have referred to the surface temperatures of stars thus far. Each star, however, ranges in interior temperature with cores reaching temperatures in the millions of degrees. Although the Sun's surface is only 5800 °C, for example, its core achieves a temperature of 15 million Celsius. With the mass of a star and its chemical composition is known, astronomers can calculate the temperatures within its core.
Main sequence stars have a core temperature of 10 million Kelvins. Red giants have a core temperature of 100 million Kelvins.
Stars come in a wide range of sizes. The sun is a star that measures about 870,000 miles across. However, astronomers classify the sun as a dwarf star. A dwarf star is a small star. A giant star is a big star. The largest stars are supergiants. Some supergiants can be 1,000 larger than the sun. Astronomers also classify stars according to color. The color of a star shows its surface temperature. Blue stars are the hottest, followed by white, yellow, orange, and red. The sun is a yellow star.