How is temperature related to color?

1) If one object is appearing blue and other object red. That doesn't always mean blue object is hotter than red? Is that correct? If yes then how is it so? I am sorry but I'm bit confused over it.

Yes it's correct: when an object is glowing blue when burning that means it has more temperature than an object glowing red. It's because an object which is glowing blue has more energy. Energy of an object of temperature $T$ (in kelvins) is calculated using this equation: $E=kT$ where $k$ is Boltzmann's constant. Energy of a light with frequency $f$ is calculated using this equation: $E=hf$ where $h$ is plank's constant. So spectral radiance of emitted light with frequency $f$ from object with temperature $T$ is calculated using $\beta(T) = \frac{2hf^3}{c^2}\frac{1}{e^{\frac{hf}{kT}}-1}$. For derivation See Plank's Law. The higher the frequency of light the more energy it has and it looks 'more blue' and the lower the frequency the less energy and it looks 'more red'.

Here's very good image of "light" (light is part of spectrum we see (visible spectrum), full spectrum is called electro-magnetic spectrum, but for simplicity let's call it just light) spectrum:

enter image description here

Here's a very good diagram of emitted light with wavelength $\lambda$ from an object with temperature $T$ (in kelvins). (NOTE: for light with frequency $f$, wavelength is $\lambda = \frac{c}{f}$ where $c$ is the speed of light.)

enter image description here

2) With the "Color Temperature" concept on Wikipedia. They say 1,700 K for match flame. But 15,000–27,000 K for a clear blue poleward sky.

This confuses me. The sky appears blue, does that mean its hot? But it isn't right? It's colder. I am not sure if I'm able to frame it properly. It's a bit confusing to me.

Is this something like a glowing object vs reflecting object? The sun is white but Earth is blue. But sun is hotter than the earth. It's the sun radiating light but earth is just scattering it.

You can calculate spectral radiance. Spectral radiance is like an (spectral radiance isn't fully intensity, it's just like an intensity) intensity of emitted light with frequency $f$ from object with temperature $T$ (in kelvins) of emitted light from an object with temperature $T$ (in kelvins) using this equation:$$\beta(T) = \frac{2hf^3}{c^2}\frac{1}{e^{\frac{hf}{kT}}-1}$$ Earth is blue because it reflects light, not emits it. But the Sun doesn't reflect light (it's a blackbody, but not perfect), it just emits it, that's why it's hotter.

Let me recommend the Wikipedia article on colour temperature but caution you that while that article is quite good, it says a few misleading things and, as usual, you might want to visit a library or do some more extensive online research. If you want to learn the math of how color and temperature are correlated in thermal radiation, look at the excellent article on Wien's displacement law. (Spoiler: it's peak wavelength of light = a constant / temperature or peak frequency of light = a different but related constant * temperature)

1) If one object is appearing blue and other object red. That doesn't always mean blue object is hotter than red? Is that correct?

That is precisely correct. In fact, most colors we see around us in the normal course of life are not correlated with temperature in this way. Physicists have found that the spectrum of radiation emitted by an object is correlated with the temperature of the object. If the object is hot enough, it emits visible light. The color temperature we are talking about here is temperature at which a perfect (black) radiator would emit radiation of the same average frequency.

If yes then how is it so? Most of the light we actually see around us is non-thermal; its color derives from differences in the properties of various materials. For example, the air molecules over our heads scatter blue light about eight times more readily than red light, so we see a strong blue color. To get light from a purely thermal source that was in some average sense "equally blue", you would have to heat that source to about four times the temperature of our Sun's photosphere.

The only thermal sources you see in everyday life are things like toaster wires or oven heating coils that get red-hot, the Sun and the fixed stars, and incandescent lights.
Anything you see by reflected light (including the planets and the Moon as well as most anything you see on Earth that isn't red hot or hotter), or scattered light (like the blue sky), or various kinds of non-thermal emission (lasers, LEDs, fluorescents, lightning). Even open flames – candlelight and firelight – are not thermal, a candle is no where near the thousands of degrees its color would seem to indicate; if you want to see how thermal colors work a good way is to watch glass blowers at work and look through the little window into their furnace.

If you use infrared cameras or goggles, you can see a representation of the thermal radiation from objects like people or trees or the warm exhaust from a vehicle. Look up "thermal imaging" in a search engine or a Library and you will find some pictures that show warm things as bright and cooler things darker. Remember the colors you see in such images are "false", you can't see those colors with your eyes, though you can feel them on your skin and some animals, like pit vipers, can "see" them directly with sense organs adapted to infrared light.

Confusingly, when people talk about "color temperature" they can mean several different things, especially:

  1. the correlated color temperature (CCT)- that is, the temperature a blackbody (perfect thermal radiator) would need to be heated to to emit light of the same average color.

  2. Some kind of "perceived color temperature" that varies depending on who is doing the color/temperature mapping. Usually this seems to run backwards from the CCT, so that red and orange are "hot" colors and blue, purple, and green are called "cool" colors, but it need not be a simple backwards map; for example, red might be called 'warm', and orange "hot", then green is "cool", and blue "cold". There is no universal list of how people rank colors psychologically or artistically in terms of temperature, in fact according to visual designers there are "warm greys" and "cool greys" that would all not even fit on the CCT scale. This means that if you are reading a book and it talks about hot or cool colors, you may have no real way of knowing what kind of color it means unless you pick it up from context in that particular book.

Also, people see color very differently from a simple spectrum analyzer; our vision is highly background and history dependent. The very same frequency that appears yellow to us in one context might seem green or orange in another context: read up on "color perception" as a topic to learn more about this.

The sky appears blue, does that mean its hot?

No, your doubts here are well justified. Blue sky is not a thermal light source. In fact, assigning it a thermal temperature is a little disingenuous as there is another way to measure "the temperature of the sky" with a telescope that gives a much more sensible answer. (you point telescope at a patch of sky and put a sort of thermometer at the focus - I assure you, you do not get 27,000 degrees for a patch of blue sky this way, but you do get the right sort of temperature for the Sun.) It would have been better to just say "If you measure the light intensity vs. frequency profile for light from this patch of blue sky, the peak intensity is blah blah, which happens to be the same as the peak frequency of the light emitted by purely thermal radiation from a star whose surface is at 25,000 degrees C, isn't that interesting?" Or some such construct.

Note that light really does have a measurable temperature in yet another way that depends on both the average frequency of the light and on how 'thermalized' the light is. In this sense, light from thermal sources like the Sun or a furnace has just the kind of temperature you read about before asking the question, but light from other sources is generally "cooler". Fluorescent light would be "cool" and laser light "extremely cold". This sense is actually the most consistent and useful way I know of to talk about light and temperature, but few people seem to use it outside of people who actually use or study atomic physics or laser physics. I believe it is likely to become more popular in the future and then people will much less often be saying confusing and silly things about the temperature of the blue sky and so on.

The wikipedia page for Color Temperature states, "The color temperature of a light source is the temperature of an ideal black-body radiator that radiates light of comparable hue to that of the light source." Meaning, an ideal blackest-of-black object. Think a hunk of volcanic rock - generally it's very black and it looks black, but it does give off a spectrum of infrared radiation due to the black-body effect. But that's not all - it may reflect light, it may have its own color, it may have a lot of other things that don't fall under the category of "perfect black-body", in which case the laws don't [perfectly] apply.

  1. If one perfect black-body appears "hotter in hue" than another, then it is hotter. However, if the objects aren't perfect black-bodies (like a bright red toy bucket compared to a bright blue toy shovel), this law does not apply. The simplest way objects can get their color is by absorbing all light that isn't that color. Such a thing is called a pigment. But if you keep asking "how does this get its color" (soap films, prisms, why the black-body curve is how it is), you'll find that things get complicated and there are lots of different ways.

  2. You're right with the sun. See this demonstration: Walter Lewin, For the Love of Physics. (There's also a demonstration with cigarette smoke earlier in the lecture). The atmosphere scatters the blue light and it ends up in our eyes. The atmosphere isn't $27000\mbox{K}$.