Light itself doesn’t necessarily have any temperature. For example, the colored lights emitted by the glowing tubes of an advertising sign don’t have any temperature associated with them. They are non-thermal light—that is, light that is not being emitted by a hot object because of its temperature.
To understand the complicated relationship between color and temperature, let’s begin by looking at thermal light. When you ignite a block of black charcoal in the grill, the temperature of that block gradually rises. Throughout the entire process, the block emits light, or more generally, electromagnetic radiation. At first the block is at room temperature and the radiation it emits is invisible infrared light. This light is actually thermal light, meaning that it is emitted by the block because of that block’s temperature and it carries with it thermal energy or heat. You don’t notice this thermal radiation because it’s invisible and dim. It’s indistinguishable from the thermal radiation that the other room-temperature objects around you emit.
But as the block warms up, its thermal radiation brightens and shifts toward shorter wavelengths and higher frequencies. A physicist would say that its “color” is shifting toward the “blue end” of the spectrum. You still can’t see this thermal radiation, but you can begin to feel its thermal energy with your hands or face. You feel warmed by it.
Once the block reaches about 400 or 500o C, you can begin to see a dim red glow. Now the thermal radiation from the block has spread into the far red edge of the visible portion of the spectrum. By 1300o C, the block appears full red and perhaps even a little orange. By 1800o C, it has the yellow glow of a candle and by 2500o C, it is bright yellow-white and burning fast.
Overall, the block emits a range of light that is characteristic of the block’s temperature. The hotter the block is, the shorter the wavelengths of that light—the more toward the “blue end” of the spectrum—and the brighter the light—the more thermal energy it carries. This thermal light doesn’t have a sharply defined wavelength or a simple color. It has a statistical spread of both wavelength and color that is an essential part of the randomness associated with thermal energy. If you were to trap this thermal light in a room full of perfect mirrors, it would be accurate to say that this light has a temperature; it was emitted by an object because of that object’s temperature and it retains all the characteristics associated with that temperature.
But what happens if you begin filtering out certain colors from the light, or if you begin adding colors to the light with fluorescent or neon lamps, or light-emitting diodes, or even lasers. In that case you no longer have thermal light. The light’s spectrum of wavelengths and its brightness aren’t characteristic of any particular temperature any more. Thus if you send sunlight through a filter that transmits only red light and ask what temperature that red light has, the answer is that the red light is no longer thermal and has no temperature.
So your question only has meaning if both lights, red and violet, are thermal. A glowing object at about 1300o C will appear red, although it will be a special type of red because of the thermal spread of wavelengths it must contain. And a glowing object at about 15000o C will appear violet, as well as being unbelievably bright. Once again, that violet will not be a pure wavelength, but rather a broad spread of wavelengths that includes a vast amount of ultraviolet light as well as visible. In this special circumstance, you can say that the violet light truly is hotter than the red light.
Answered by Lou A. Bloomfield of the University of Virginia