First to know is that what we see as light or colours are electrons falling from a higher orbit around the nucleus (?) to a lower one. When they fall down they emit energy. And if enough electrons do that, in a specific interval we can see that as light. The interval is what you might have heard of as wavelength.
Now. The hotter an object the fast the electrons move and the faster they drop down to a lower orbit. And the different speeds/intervals of them dropping down an orbit are different colours.
Latest Answers