Why do different elements produce different colors?
Similarly, why do different salts produce different colors?
Those colors are a result of electrons in the atoms being excited up into higher energy levels by the heat of the flame.
Considering this, what are the different colors emitted by different elements?
Because each element has an exactly defined line emission spectrum, scientists are able to identify them by the color of flame they produce. For example, copper produces a blue flame, lithium and strontium a red flame, calcium an orange flame, sodium a yellow flame, and barium a green flame.
Each electron in an atom has a specific amount of energy. Because no two elements have the same set of energy levels, different elements emit different colors of light. Energy is released when electrons move from higher energy levels to lower ones (visible light).