Updated: November 12, 2011
You have all seen candles burn, glazed at your barbecue set sizzling and spitting, used a blowtorch to peel paint or melt a favorite childhood toy, or enjoyed the warmth of logs cracking in the fireplace while sipping wine with your mistress in the cabin lodge far away from home. Ahem, yes. Which brings me to a joke. There are three things that people never get tired of doing: looking at a fire burning, water running and other people laboring. Hence, the greatest joy of all is to watch firemen at work. But that's neither here, nor there. Back on topic.
Anyhow, whether it's a stove, an oven, a Bunsen burner or anything else, you've noticed that flames come in different colors and shapes. But mostly, the flames are yellow or blue. The question is, why? If we consult the physics books, we will learn about the so-called black bodies. This physics concept tells us that black bodies are supposed to emit radiation that is equivalent to their temperature. Hence, an object emitting blue light should have a temperature of about 6000K. That's hot. But that's not what happens. So what does?
A brief introduction
Wikipedia has beat me to it and published a number of rather interesting articles on both the flames and black body radiation, so you can read all the fancy stuff there. But I'd like to focus on the more down-to-earth aspects of the problem at hand. First, we will talk some more about the black bodies.
Black bodies are an ideal concept and do not really exist. Still, the reality is good enough. Black bodies emit radiation that reflects their internal thermal energy. The human body is a good example. The warmth of human bodies comes from infrared radiation that we emit. Our eyes cannot see in the infrared spectrum, so we perceive heat as something magical, but it's just low-energy photons doing their work.
A counter-example would be the neon lights we sometimes use in our homes. They shine bright-white, brighter than incandescent bulbs, and yet they are perfectly safe to touch. The reason for this is that the radiation comes from a different mechanism than thermal excitation. Hence, neon lights are not black bodies.
Back to color
So, we know that red color signifies lower temperatures, blue stands for higher temperatures, with yellow somewhere in between. Purple and white means we're already doubling in ultra-violet, while beyond, there's x-ray. This means that yellow flames are cooler than the blue ones. But this creates a bit of a problem for us.
First, why would you have candle flame that has two distinct colors, yellow and blue, so close together? How can you have a temperature gradient that is so steep, if you will? Second, why there's no green? Finally, is it really possible for some of the materials we use in cooking and home improvement to burn so hot? According to all kinds of chemistry brochures, gases and liquids used in household sammich making do not have very high temperatures. For example, propane peak flame temperature at a normal atmospheric pressure is 1,990 degrees Celsius. This is hardly sufficient to justify the blue color. So what gives?
Enter oxygen and soot
When you kickstart your oven burner to boil some water or dump fresh lumps of coal onto into the fire ring pending the sacred steak ceremony, you introduce a whole new range of elements [sic] into the equation. The resulting change in flame color has less to do with the thermal properties of the fuel and more with how clean the fuel is and how even and rich the air fuel mixture is. Let me elaborate.
Combustion requires an oxidant. Most oxidant have some portion of oxygen, including air, ozone, many halogens, some acids, and more. The richer the oxidant is, the more complete the combustion will be, resulting in higher temperatures. But for all practical purposes, the only oxidant we will have is the air surrounding us.
Anyhow, a good example is when you fan the coals to get them glowing white. You introduce a high volume of oxygen into the fire, allowing a better combustion. Normally, the coals are starved, burning at a sub-optimal temperature, which reflects in their dull, red color. But when you stir the flames, they glow white and hot. You also help create a more uniform air-fuel mixture, again helping the combustion process.
But that's only part of the equation. There's the fuel purity to consider. The cleaner the fuel, the fewer combustion residues will be created in the burning process. Household gas is normally pure, thus you will see little to no unwanted by products, like soot or smoke. If you take a look at your pans, they do not blacken after being used, because there's little dirt in the gas. Compare that to barbecue grills and you'll see the difference.
If you burn an unclean fuel, a part of the process will also include the secondary products in the fuel. At home, most of these will be low-energy products, burning at lower temperatures, hence you will see predominantly red, orange and yellow flames, even though the pure fire color should be different. There's your yellow.
Finally, the blue color has nothing to do with super-hot black bodies. It is the result of excited molecular radicals in the flame, which mostly emit their light in the blue spectrum. A candle flame is a good example. At the base of the wick, the flames will be blue. Farther away, there will be less molecular radicals and more soot, resulting in yellow flames. You won't see all of the colors of the spectrum, because they have less to do with the black body properties of the candle and more with the fuel composition and purity.
Fire colors can easily be manipulated. You all must have seen that one experiment where university students impress high-school children by sprinkling metal powders into flames, changing their color. So yes, there's that trick. You must have been amazed. I know I was.
Microgravity
All of what I've written above changes when you remove the gravity from the equation. Microgravity is the shizzles. When you remove the gravity factor from a combustion equation, all kinds of wonders happen. The fire burns more uniformly, there less soot, you save fuel. Sounds too good to be true, but there it is.
Quoting from Wikipedia: The common distribution of a flame under normal gravity conditions depends on convection, because soot tends to rise to the top of a flame, such as in a candle, making the flame yellow. In microgravity or zero gravity, such as an environment in outer space, convection no longer occurs, and the flame becomes spherical, with a tendency to become more blue and more efficient. There are several possible explanations for this difference, of which the most likely one given is the hypothesis that the temperature is evenly distributed enough that soot is not formed and complete combustion occurs. Experiments by NASA in microgravity reveal that diffusion flames in microgravity allow more soot to be completely oxidized after they are produced than diffusion flames on Earth. Premixed flames in microgravity burn at a much slower rate and more efficiently than even a candle on Earth, and last much longer. This thing is tight. Take a look at some breath-taking images below. Awesome.
More reading
Some more fancy stuff for you:
Black body on Wikipedia
Flame on Wikipedia
Combustion on Wikipedia
Smoke on Wikipedia
Microgravity on Wikipedia
Conclusion
There you go, the pyromaniac fanboy club article of the day. But seriously, this is such a trivial and yet so difficult question. Something we see and do every single day of our lives, and yet, it has such an elaborate and elusive answer. Now, if you've never wondered why something as innocent as the candle flame is the way it is, you must be leading a happy, blissful life, full of ignorance and whatnot. And if you did, hopefully, there's the explanation, right there.
So that would be all. Soon, we will dabble in alchemy and try to make gold from other elements, w00t. Stay tuned, and if you have any wicked ideas that you would like to see explored in unique and unfunny ways the way I do, feel free to use the mail service.
P.S. The microgravity and the sun flare images are in the public domain.
Cheers.