Most lobsters are colored a mottled dark greenish brown. In rare cases, a lobster of a different color (colormorph) appears. Exotic lobsters in shades of blue, white, yellow, black, and red have been reported from time to time since the earliest lobster harvests. Perhaps the most unusual colormorphs are the "calico" lobsters appearing as marbled black and orange/yellow; or "half-and-half" lobsters with a line straight down their backs where two colors meet.
Calicos and half-and-halfs are hatched that way and they stay that way (until cooked!) because the basic color pattern in lobster shells is inherited just like the color of hair in humans and other mammals.
However, some of the blue, brown, green, red, and black tones can be genetic or they can have other causes. In some instances lighter/darker shades can be influenced by diet, sunlight, and bottom type. For example, if you put a blue lobster in a holding system and its color becomes normal over a period of time, that lobster is undoubtedly not a 'igenetic blue." It was probably blue as a result of a dietary deficiency.
Lobsters get their characteristic color, not only from genctics, but, also from the foods they eat. A natural-colored lobster fed a diet of squid will turn blue. A lobster deprived of all prey that eat phytoplankton (floating plantlike critters) appears pale blue.
Lobsters need to eat things that eat plants to get a carotenoid (pigment found in carrots) called astaxanthin (relative of pigment found in carrots), which binds to a protein in the lobster's shell. If lobsters do not get carotenoids from their diet, they can not bind the pigment because only plants can manufacture carotenoids.
The protein to which astaxanthin binds in natural-colored lobsters is blue in lobster shells and green in lobster eggs. When the astaxanthin is not in the diet, would-be natural colored lobsters appear blue because the blue pigment in the protein expresses itself.
So, then, why do lobsters turn red when you cook them? Because the carotenoid is allowed to express itself. Heat breaks up protein bonds. When you cook a lobster the bond between the protein and the carotenoid breaks down and the red color becomes visible.
How, then, do you explain live red lobsters? A live red lobster is red because its genetically based protein-astaxanthin complex is rednot because it has free astaxanthin!