To understand why various objects appear in different colours, we have to start with colour itself. What we perceive as colour is actually our brain’s interpretation of signals coming from the retina of our eyes. Such signals are triggered when electromagnetic waves fall onto the millions of light-sensitive cells covering the retina.
The energy of an electromagnetic wave is associated with its frequency (f, note that frequency times wavelength, λ, gives the speed of light, which is constant c in vacuum). Visible lights only make up a tiny part of the whole spectrum of electromagnetic wave as shown below. Evolution results in that our eyes are only sensitive to those with frequency within the visible spectrum.
Light from the sun contains electromagnetic waves of different wavelengths, mostly within the visible spectrum, when combined together, it appears white. One way to show this is to pass white light through a prism. Due to the different angles of refraction for electromagnetic waves of different frequencies, they split up upon exiting the prism. In fact, the same principle is responsible for the formation of rainbow. Light from the sun or other sources is the reason that we see things. How light interacts with the object gives rise to the colour that we see.
As we know, all materials are made of atoms, and every atom contains positive nucleus with certain number of electrons moving around the nucleus (different number of electrons per atom correspond to different elements). These electrons move around the nucleus with different, discrete binding energies. When combined together to form a substance, some electrons remain bound with the nucleus, others break away forming free (or partially free) electrons in the substance. When sunlight shines onto an object, electromagnetic waves of different frequency interact with electrons in the object, leading to some being absorbed, others reflected or transmitted. If all waves are absorbed, the object appear black. If all waves are transmitted, the object appear transparent. Otherwise, the colour of the electromagnetic wave that is not absorbed gives rise to the colour of the object.