Here's why:
* Realism: Historically, cowboys wore hats for protection from the sun and elements, and the color varied depending on availability and personal preference.
* Character Representation: Movie cowboys are often given hat colors that reflect their personality or alignment. For example:
* White: Often represents a "good guy," a hero, or someone who's clean-cut and honest.
* Brown/Tan: More common, signifying practicality and a connection to the earth. Could be worn by both good and bad characters.
* Black: Might signify a mysterious figure, or someone who's hardened and experienced.
* Other Colors: Movies sometimes use brighter colors to stand out, or even to signal a comedic character.
So, it's more about the symbolism of the hat color than a strict rule!