With a fire, the closer you are, the hotter it gets. The sun is different. The very outside light around the sun, the corona, is much hotter than the surface. Inside the center of the sun is the hottest place. No one knows why the corona is so hot.
Scientists take the sun's temperature by looking at the light from the sun.
When sunlight goes through a prism, it makes a rainbow of colors. The rainbow for white light has red, yellow, green, and blue. The sun is made up of different kinds of gas. Different kinds of gas on the sun make different patterns of colors. The patterns of colors tells a scientist what kind of gas is burning in the sun.