The correspondence between temperature and (radiant) color is called the black body effect. The less ideal a black body something is, the less strongly this rule is adhered to. In physical reality, there is no perfect black body, and one cannot—as a matter of fact—determine the temperature of a star by its color alone. The "color temperature" of a star does not strongly correspond to its actual temperature.
It's important to understand that a star is not a ball of fire. It's a ball of nuclear and chemical reactions that contains several different elements, all of which can modify the optical properties of the star as viewed from far away.
Also, your question has an ambiguous component: Hotter at what distance? Distance from the center or from the surface? Stars have different volumes, different masses, different chemical compositions, and tend to be coldest at their surface, and hotter in either direction from that layer.
--- Extra ---
One other thing that needs to be taken into account is redshifting and blueshifting due to the Doppler Shift. When stars are moving away from us, they redshift, and light coming from those stars move over to the red part of light spectrum, and when stars are coming towards us, they blueshift towards the blue part of the light spectrum.
This is easily demonstrated when thinking about when you hear an ambulance coming towards you with the siren going. As it's approaching you, the pitch of the siren is high, and as it passes you it lowers in frequency/tone. This is due to Doppler shifting, and it works the same way with light. So for something that's approaching, the waves are coming at you at a higher frequency than if it's going away from you. Another way to illustrate this is by imagining a drop falling into water, and then the ripples which will then flow in all directions. If the drop hits the water each second, then the ripples will be 1 second apart, yet if you were to...lets say move towards the area where the drop hits the water, the ripples will hit you more frequently due to your speed at which you are moving...and the same goes for sound and light.
So stars which are approaching us, will have it's light waves hit us at a higher frequency, and shift it to the blue spectrum, and those moving away from us will have it's wave lengths increased an thus towards the red spectrum.
The final thing which needs to be taken into account is the gas of which the star consists, and the brightness it should normally be when burning. The reason for that is that if the star naturally burned at a color slightly to the red spectrum, and was moving away from us, the red light will be shifted further to the red, and then go into the infra-red, which is invisible to us. The light from the UV range will now become visible to you as blue light, and thus the star would appear to be blueshifting, although it's actually redshifting.