Although animals display a rich variety of shapes and patterns, the genetic changes that explain how complex forms arise are still unclear. Here we take advantage of the extensive diversity of Heliconius butterflies to identify a gene that causes adaptive variation of black wing patterns within and between species. Linkage mapping in two species groups, gene-expression analysis in seven species, and pharmacological treatments all indicate that cis-regulatory evolution of the WntA ligand underpins discrete changes in color pattern features across the Heliconius genus. These results illustrate how the direct modulation of morphogen sources can generate a wide array of unique morphologies, thus providing a link between natural genetic variation, pattern formation, and adaptation.