While they might be bright red when they hit your dinner plate, crabs and lobsters are usually brown, olive-green or gray when alive and in the wild (at least in the mid-Atlantic U.S.; crustaceans farther south come in a variety of vibrant colors). The dramatic color change during cooking has to do with the way certain biochemicals inside the shellfish react to heat.

Lobsters and crabs have a pigment called astaxanthin in their shells. Astaxanthin is a carotenoid pigment: absorbing blue light and appearing red, orange or yellow in color. While the crustaceans are alive, astaxanthin lies wrapped in the tight embrace of a protein called crustacyanin. The protein holds the pigment so tight, in fact, that it’s flattened and its light-absorption properties are changed. The astaxanthin-crustacyanin complex then winds up giving off a blue-green color.

These biochemical cuddle buddies get separated when a crab or lobster is cooked. Crustacyanin is not heat-stable, so introducing it to a boiling pot of water or a grill causes it to relax its bonds with astaxanthin, unravel and let the pigment’s true bold red color shine through.

An estimated 1 in 100 million lobsters are albino and don’t have any pigments in their shell. They’ll go cooked to the dining room the same color they went live into the pot: a ghostly gray-white.

Shrimp also have carotenoid pigments in their shells and flesh, and these are also hidden until they’re released by heat. So how do flamingoes, with diets heavy with carotenoid proteins but which usually don’t have kitchen access, take on the bright pink of their dinners’ pigments without cooking them? The proteins that mask the pigments not only unravel in the presence of heat, but also dissolve thanks to the acids and fats inside flamingos during digestion. The freed proteins then give birds’ feathers a soft pink hue.