Because the elements that have a higher EN can seize ilektron from the elements with lower EN so the color has come out to be the color of the element's ilektron.
For elements with EN higher than the car to steal electrons from the elements with EN below, and the color is a color that has come out of the elements were deprived of their electrons.
Because the elements with higher EN can steal from elements of the electron EN lower so the color turned out to be the color of the element being replaced ion.