The yellow gene family is intriguing for a number of reasons. To date, yellow-like genes have only been identified in insect species and a number of bacteria. The function of the yellows is largely unknown, although a few have been associated with melanization and behavior in Drosophila, and a unique clade of genes from Apis mellifera may be involved in caste specification. Here, we show that yellow-like sequences are present in bacteria, insects, and fungi but absent from other eukaryotes apart from isolated putative sequences in Amphioxus, the Salmon Louse, and Naegleria. The yellow-like family forms a discrete gene class characterized by the presence of a major royal jelly protein domain, but eukaryote yellow-like proteins are not monophyletic. The unusual phylogenetic distribution of yellow-like sequences suggests either multiple horizontal transfer from bacteria into eukaryotes or extensive gene loss in eukaryote lineages. Comparative analysis of yellow family synteny and gene order demonstrates that a highly conserved block of three to five genes has been maintained throughout insect diversification despite extensive genome rearrangements. We show strong purifying selection on seven yellow genes over approximately 100 My separating the silkmoth and Heliconius butterflies and an association between spatial regulation of gene expression and distribution of melanic pigment in the developing butterfly wing. A single ancestral yellow-like gene has therefore undergone multiple rounds of duplication within the insects accompanied by functional constraint on both genomic location and protein evolution.