Abstract Background The factors that maintain phenotypic and genetic variation within a population have received long-term attention in evolutionary biology. Here the genetic basis and evolution of the geographically widespread variation in twig trichome color (from red to white) in a shrub Melastoma normale was investigated using Pool-seq and evolutionary analyses. Results The results show that the twig trichome coloration is under selection in different light environments and that a 6-kb region containing an R2R3 MYB transcription factor gene is the major region of divergence between the extreme red and white morphs. This gene has two highly divergent groups of alleles, one of which likely originated from introgression from another species in this genus and has risen to high frequency (> 0.6) within each of the three populations under investigation. In contrast, polymorphisms in other regions of the genome show no sign of differentiation between the two morphs, suggesting that genomic patterns of diversity have been shaped by homogenizing gene flow. Population genetics analysis reveals signals of balancing selection acting on this gene, and it is suggested that spatially varying selection is the most likely mechanism of balancing selection in this case. Conclusions This study demonstrate that polymorphisms on a single transcription factor gene largely confer the twig trichome color variation in M. normale, while also explaining how adaptive divergence can occur and be maintained in the face of gene flow.