Aposematism and warning coloration are common defense strategies used by animals to deter predators. Pestilential gregarious locusts display a striking black-brown pattern, which is presumed to be a form of warning coloration compared to green solitary locusts. However, the specific mechanisms involved in regulating this distinctive pattern are not yet understood. Here, we found that different amounts of β-carotene and β-carotene-binding protein (βCBP) complexes confer the black tergum and brown sternum of locust. The expression level of βCBP is regulated by the bZIP transcription factor ATF2, which is activated by protein kinase C alpha (PKCα) in response to crowding. Specifically, ATF2 is phosphorylated at Ser327 and translocates to the nucleus, where it binds to specific sites on the βCBP promoter and stimulates overexpression. Differential phosphorylation of ATF2 resulted in the divergent black and brown body coloration of gregarious locusts. The overexpression of βCBP in the sternum is essential for the accumulation of red pigments, which creates the sharp contrast between the black tergum and the brown sternum. This spatial variation in ATF2 phosphorylation levels allows locusts to adapt to changing environmental conditions and better evade predation.