Why are stars different colors?

A star’s color hints at its temperature — hotter stars look blue-white, cooler ones look orange-red.