For most of its history, melancholy was not a mood. It was a diagnosis, and the cause was supposed to be a dark fluid in the body.
The word comes from Greek melankholia, literally an excess of black bile. It joins melas, "black," and khole, "bile." In the humoral medicine handed down from the Greeks through Galen, health depended on four humours: blood, phlegm, yellow bile and black bile. Black bile was thought cold and dry, and a temperament ruled by it was melancholic.
The term passed into Late Latin as melancholia and into Old French as melancolie, where it could also mean ill temper or annoyance. English recorded it around 1300 as melancolie or malencolie. It named a mental disorder marked by gloom, irritability and sudden, causeless anger. The spelling with mal- came from a false link with French mal, "sickness."
Ordinary sadness joined the medical meaning early. By the mid-1300s the word could mean sorrow or gloom, often from love or disappointment. A 1623 dictionary still defined it as "The grossest of the foure corporall humours," one that brought heaviness and sadness of mind.
The great English monument to the idea is Robert Burton's The Anatomy of Melancholy, first published in 1621 under the pen name Democritus Junior. Burton spent his life at Christ Church, Oxford, and kept revising the book. The first edition ran to about 350,000 words. By the posthumous edition of 1651 it exceeded 500,000.
Burton defined melancholy as "a kind of dotage without a fever." Its usual companions, he wrote, were fear and sadness "without any apparent occasion."
When humoral medicine faded in the 1700s, the word survived without its theory. It came to mean a gloomy state of mind, especially a habitual or prolonged one. As an adjective it widened too. By 1710 a fact or situation could be melancholy, meaning deplorable.
The humours left other traces in English. Choler and cholera both come from the same Greek khole. Cholera meant bile in late 14th-century English, and from the 1560s it named a digestive disorder. The Latin translation of melankholia, atra bilis, gave English atrabilious, recorded from the 1650s for someone affected by melancholy.