The color of a star, determined by the most intense frequency of visible light, depends on the temperature of the outer layers of the star, including its photosphere.
The surface temperature of a main sequence star is determined by the energy production rate of its core and by its radius, and is usually calculated from the color index of the star. The temperature is normally given in terms of an effective temperature, which is the temperature of an idealized black body that radiates its energy at the same surface luminosity as the star.The temperature in the central region of a star is several million Kelvin degrees.
The largest stars in the main sequence can have surface temperatures of 50,000 K. Smaller stars such as the sun have surface temperatures of a few thousand K. The red giants have relatively low surface temperatures of about 3600 K; but they also have a high luminosity due to their large outer surface area.