When guests arrive at Westworld they are greeted and offered individually custom tailored clothing. One of the many choices offered both male and female guests is the color of the hat they will wear: white for a 'good guy', and black for a 'bad guy'.
Notable White Hats
Notable Black Hats
In Western movies, between the 1920s and the 1940s, white hats were often worn by heroes and black hats by villains to symbolize the contrast in good versus evil. The 1903 short film, The Great Train Robbery, was the first to apply this convention. Two exceptions to the convention were portrayals by William Boyd (active 1918–1954), who wore dark clothing as Hopalong Cassidy, and Robert Taylor's portrayal in the film The Law and Jake Wade (1958).
The book Investigating Information Society said the convention was arbitrarily imposed by filmmakers in the genre with the expectation that audiences would understand the categorizations. It said whiteness was associated with "purity, cleanliness, and moral righteousness", which is reminiscent of a woman's wedding dress traditionally being white.
In the 21st century, Westerns have referenced the convention in different ways. In the 2005 film Brokeback Mountain, one of the two starring cowboys wears black while the other wears white. The film does not disclose any standard conventions for the symbolism other than the wearer of the black hat being shot, as in the early films. In the 2007 film 3:10 to Yuma, a remake of the 1957 film, a henchman hiring local gunmen to free his boss from jail, tells them not to shoot at "the black hat", a light reference to the convention.
This convention also gave rise to the terms "White Hat" and "Black Hat" being used to refer to ethical and malicious computer hackers.