On heating an alkali earth metal or its salt, the electrons are excited easily to higher energy levels because of absorption of energy. When these electrons return to their ground states, they emit extra energy in form of radiations which fall in the visible region thereby imparting a characteristic colour to the flame. The violet flame shown by potassiu in Bunsen flame is due to jumping of the electron from 5p to 4s.