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 are 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 known, astronomers can calculate the temperatures within its core.
Main sequence stars have a core temperatures of 10 million Kelvins. Red giants have a core temperatures of 100 million Kelvins.