Genetic polymorphisms underlie the convergent and divergent evolution of various phenotypes. Diverse colour patterns on caterpillars, which are ecologically important, are good models for understanding the molecular backgrounds of phenotypic diversity. Here we show that a single evolutionarily conserved gene apontic-like (apt-like) encoding for a putative transcription factor accounts for the silkworm p locus, which causes at least 15 different larval markings involved in branch-like markings and eye-spot formation. The expression of apt-like and melanin synthesis genes are upregulated in association with pigmented areas of marking mutants Striped (p(S)) and normal (+(p)) but not in the non-marking allele plain (p). Functional analyses, ectopic expression, RNAi and TALEN, demonstrate that apt-like causes melanin pigmentation in a cell-autonomous manner. These results suggest that variation in p alleles is caused by the differential expression of the gene apt-like which induces targeted elevation of gene expressions in the melanin synthesis pathway. 