The wearing of colored bandanas around the neck as a practical accessory was common in the mid- and late-nineteenth century among
cowboys,
steam railroad engineers, and
miners in the
Western United States. It is thought that the wearing of bandanas by gay men originated in
San Francisco after the
Gold Rush, when, because of a shortage of women, men dancing with each other in
square dances developed a code wherein the man wearing the blue bandana took the male part in the square dance, and the man wearing the red bandana took the female part (these bandanas were usually worn around the arm or hanging from the belt or in the back pocket of one's
jeans). The modern hanky code is often reported to have started in New York City around 1970, when a journalist for the
Village Voice joked that instead of simply wearing a set of keys on one side or the other (then a common code to indicate whether someone was a "top" or a "bottom"), it would be more efficient to subtly announce their particular sexual focus by wearing different colored handkerchiefs. Other sources attribute the expansion of the original red–blue system into today's code to marketing efforts around 1971 by The Trading Post, a San Francisco
department store for erotic merchandise, promoting handkerchiefs by printing cards listing the meanings of various colors.
Alan Selby, founder of Mr. S Leather in San Francisco, claimed that he created the first hanky code with his business partners at Leather 'n' Things in 1972, when their bandana supplier inadvertently doubled their order and the expanded code would help them sell the extra colors they had received. Around 1980, ''
Bob Damron's Address Book'' published a yearly chart for the meaning of each colored handkerchief. ==Examples==