One of the main purposes of blood is the transport of oxygen around the body; this oxygen is required for cellular respiration and without it cells in the body will die.
In humans and other vertebrates, oxygen is transported in the blood by a protein called haemoglobin that is contained within red blood cells. Each haemoglobin molecule contains four iron ions to which an oxygen molecule can bind. The oxyhaemoglobin that is formed when oxygen molecules bind to haemoglobin is bright red, which gives blood its red colour.
A haemoglobin molecule. The oxygen binding sites are at the centre of the green haem groups.
It is possible for humans to develop blood with a greenish hue if suffering from a condition called sulphaemoglobinaemia, in which a sulphur atom is incorporated into the haemoglobin molecule.
But haemoglobin is not the only molecule capable of transporting oxygen in blood. In molluscs like crabs, octopuses, oysters, slugs, snails, squid, worms and many others, oxygen is transported by haemocyanin, which contains copper rather than iron.
A haemocyanin molecule. The oxygen binding site is at the centre, in between the two copper atoms.
Deoxygenated haemocyanin is grey or pale yellow, and when oxygenated (for example by exposure to air) the oxyhaemocyanin is a dark blue colour.
The interior of a crab shell. The purple colouring is due to the presence of oxyhaemocyanin.
There are a number of other oxygen-binding proteins found in nature which give rise to a number of different blood colours. For example, haemerythrin gives some annelids and marine invertebrates pink/violet or clear blood; annelids also use chlorocruorin which gives them red or green blood.