Drosophila melanogaster males perform a series of courtship behaviors that, when successful, result in copulation with a female. For over a century, mutations in the yellow gene, named for its effects on pigmentation, have been known to reduce male mating success. Prior work has suggested that yellow influences mating behavior through effects on wing extension, song, and/or courtship vigor. Here, we rule out these explanations, as well as effects on the nervous system more generally, and find instead that the effects of yellow on male mating success are mediated by its effects on pigmentation of male-specific leg structures called sex combs. Loss of yellow expression in these modified bristles reduces their melanization, which changes their structure and causes difficulty grasping females prior to copulation. These data illustrate why the mechanical properties of anatomy, not just neural circuitry, must be considered to fully understand the development and evolution of behavior.