Colour is a property of the light reflected or transmitted by any substance. Depending on the substance's characteristics (energy levels of constituent levels, bonding, intermolecular forces), there are certain available energy levels (molecular orbitals, bands etc) for the electrons. Whenever any wide spectrum energy is available to a compound (considering only the visible spectrum), then depending on the various energy gaps between the available to the electrons, different wavelengths will be selectively absorbed and re-emitted, but now in any random direction, therefore the reflected and the transmitted light will be partially deficient n these wavelengths. The absorption and re-emission is very characteristic of all substances, and hence, the wavelengths absorbed and the resultant spectrum (transmitted or reflected) will be characteristic. Depending on this spectrum, various colours can be seen for different compounds.
Sometimes, the energy gap between the electron energy level is very high and therefore the light in the visible spectrum cannot excite the electron. No wavelength will be absorbed and it will act as a transparent glass. If say, the gap corresponds to a energy gap of $E=h(4000A)$, then the blue light will be absorbed and the remaining light will be white-blue=yellow. This is the general way in which colors are produced. The energy gaps can be anything, the band gaps in metals, molecular orbital energy difference in covalent compounds, orbital energy difference in isolated elements, or simply the energy difference between the various vibrational modes in a gas/solid.