Animal pigmentation plays a key role in many biological interactions, including courtship and predator avoidance. Sympatric benthic and limnetic ecotypes of threespine stickleback (Gasterosteus aculeatus) exhibit divergent pigment patterns. To test whether differential predation by cutthroat trout contributes to the differences in pigmentation seen between the ecotypes, we used a within‐generation selection experiment on F2 benthic–limnetic hybrids. After 10 months of differential selection, we compared the pigmentation of fish under trout predation to control fish not exposed to trout predation. We found that stickleback exhibited more lateral barring in ponds with trout predation. Ponds with trout were also less turbid, and a greater degree of barring was negatively correlated with the magnitude of turbidity across pond replicates. A more benthic diet, a proxy for habitat use, was also correlated with greater lateral barring and green dorsal pigmentation. These patterns suggest that differential exposure to cutthroat trout predation may explain the divergence in body pigmentation between benthic and limnetic ecotypes.