From observing how different elements here on Earth react to heat, astronomers figured out early on that a star's color was an indication of its brightness. A filament in a light bulb provides us with a simple example. As the filament gets hotter, the color changes through reds to orange, then yellow, then white, then a brilliant blue-white. The color changes have to do with the way that our eyes perceive visible light. Remember that the light we can see, the narrow portion of the electromagnetic spectrum called visible light, ranges from red through blue.
Red wavelengths are longer than blue wavelengths.
As an object heats, it emits infrared radiation. Infrared is invisible to our eyes, but we can feel it as heat. Infrared wavelengths are longer than the wavelengths of visible light, so an object of a certain temperature will emit most of its energy in the infrared and some in the visible red end of visible light. Our filament glows a dull red. The filament glows orange.