Ancient physicians, Hippocrates, Galen, and others, and even the physicians of the Middle Ages, believed that the body was governed by four primary fluids, or humors, as they said, using the Latin term for “fluid.”
These four fluids were the blood, the yellow bile, the black bile, and the phlegm.
The nature of the four fluids was supposed to be hot and sweet, hot and dry, cold and dry, and cold and clammy, respectively, the Latin terms for these (some taken from the original Greek) being sanguineus, cholericus, melancholicus (from Greek melas, black and chole, bile), and phlegmaticus.
The meanings of our words sanguine, choleric, melancholic, and phlegmatic accordingly trace back ,to those original senses.
Thus, in olden days, a person said to be of sanguine humor was of ruddy countenance and had a courageous, hopeful, and amorous temperament; one of choleric humor was bilious and jaundiced, and of irascible temperament; one of melancholic humor was characterized by sullenness, sudden outbursts of anger, and fits of depression; and one of phlegmatic humor had a marked inclination toward indolence and apathy.
By a natural extension, humor thus became a synonym for temperament or disposition. In the sixteenth century the meaning of humor was further extended to unreasoned preference, capricious fancy, and at this period it became one of the most overused words in the language.
Shakespeare poked great fun at this tendency to run the word into the ground when, in Merry Wives of Windsor and in Henry V, he has the character, Corporal Nym, interlard almost every sentence with “humor.”
From this use developed the further extension that we understand chiefly by humor today, the quality of being amusing or of perceiving that which is droll or whimsical.