Basically ionising & aromatic compounds, dyes have Chromophores present in them with their structures having Aryl rings that have de-localized electron systems. These structures are responsible for absorption of electromagnetic radiation that features varying wavelengths (as per the energy of electron clouds).
These Chromophores make dyes highly effective in their ability to absorb radiation. Further, Chromophores also act by making necessary energy changes in de-localized electron cloud of dye that invariably results in compound absorbing radiation within visible range of colors (not outside it).
Electrons may result in loss of color with their removal causing rest of electrons to revert to local orbits. A good example of this is Schiff's reagent; a sulphurous acid that reacts with Pararosaniline. This leads to Sulphonic group attaching itself to compound's central carbon atom which hampers conjugated double bond system of Quinoid ring. It causes electrons to become localized and as a result ring ceases to be Chromophore, thus rendering dye colorless.