Why barns are red
The short answer: Cost! White paint, which got its tint from white lead, was tougher to come by and more expensive than red paint, which was tinted with the much more plentiful ferrous oxide, or rust. Farmers used a combination of linseed oil and rust to protect their barn wood from decay.
Why shutters are green
Emerald hues were all the rage after the 1775 invention of Paris green, a compound used as a paint pigment. Its namesake paint originally got its tint from arsenic, which acted as a preservative. Later, it was discovered that the paint had a poisonous quality, and homeowners used it in an effort to keep mosquitoes, flies, and other insects at bay.
Why porch ceilings are blue
Two reasons: Ghosts and Victorians (really!). In the Southern tradition, "haint blue," a pale blue-green, was used overhead to ward off "haints," the restless spirits of the dead. But Victorians favored blue porch ceilings because they mimicked the color of the sky and gave the feeling of a nice day even when it was overcast and gray.
Why farmhouses are white
White paints were more popular for houses because of their association with cleanliness and purity. Plus, lead- or zinc-oxide-laced white paints lasted longer than other colors and were easy to touch up.