In 1950s London, when homosexuality was illegal, young homosexual men first used trousers made of red corduroy as a means of identifying one another at a distance, and of indicating that they were available for sexual liaisons with other men.
The trend is thought to have started out among recently-demobilised gay ex-army officers, but soon spread through polari subculture to encompass gay men in general.
The logic behind it was that red corduroy trousers are so hideous that only men who understood their true meaning would ever wear them, so there was no room for misunderstanding.