|MadSci Network: Chemistry|
This is a very reasonable question with an extraordinarily complicated answer! There is a whole large branch of physics and chemistry known as spectroscopy, whose whole purpose is to address this question in a slightly more general form. According to our present understandings, light comes in little parcels of energy known as photons. A photon of a particular colour (or wavelength) always has exactly the same amount of energy. Photons of different colours have different energies, characteristic of each colour. Molecules are complicated structures of atoms and electrons. A molecule can have different amounts of energy, depending on how much the atoms and electrons within the molecule are vibrating. But it is usually restricted to a series of fixed values of energy -- it cannot have any old energy. Light gets absorbed only in a very special circumstance: a photon must encounter a molecule which has just the right amount of energy so that the extra energy of the photon will take it to another of its special series of allowed energies. White light consists of photons of all of the different colours and energies in the rainbow. When ordinary white light falls on a blue copper sulfate crystal, the violet, indigo, blue, and green photons have too much energy to get the copper sulfate to its next energy level, while the red photons do not have enough energy. But the orange and yellow photons have just the right amount of energy. So these colours are absorbed, and all of the other colours which are reflected or transmitted mix together to make the crystals look blue. So how do we know what colour a particular substance will be from its molecular formula? Well, to answer that question completely we would need to be able to calculate all of the allowed energy levels of a particular molecular structure very precisely, and then we would also need to think about how those energy levels might be modified a bit by the environment -- whether the molecule is in a solid, or a solution, or a liquid, or a finely divided dispersion. Even with the best computers in the world we can only just do these calculations in a fairly rough way. We certainly cannot achieve the detail and accuracy we would like to when we are calculating molecular energy levels or environmental perturbations of these levels. And the detail of these perturbations is very important. Did you know, for example, that although gold metal is usually a yellowish colour, it is also possible to prepare thin films or colloidal dispersions of gold that are brown, purple, or ruby red in colour? Here are a few general rules: a little later in chemistry you will learn about bonding structures. Molecules in which all of the electrons are paired up usually form substances that are white or transparent. That is, they do not absorb visible light, only infrared or ultraviolet. Molecules with odd electrons, and particularly with odd numbers of electrons, are usually coloured, on the other hand. Molecules made from elements in the main group of the periodic table (s & p elements) are usually found to be white or colourless. The heaviest of them, like lead and bismuth, often form compounds that absorb violet light, and so look yellowish. Transition metals (d elements) often form brightly coloured compounds, while rare earths (f elements) specialize in pale pastel shades. Metals are always opaque and moderately reflective. But these are only very broad general rules, and there are plenty of exceptions. The relationship between molecular structure and light absorption is genuinely complicated.
Try the links in the MadSci Library for more information on Chemistry.