Carotenoids are important pigments producing integument coloration; however, their dietary availability may be limited in some environments. Many species produce red to yellow hues using a combination of carotenoids and self-synthesised pteridine pigments. A compelling but untested hypothesis is that pteridines replace carotenoids in environments where carotenoid availability is limited. Based on a phylogenetic comparative analysis of pigment concentrations in agamid lizards, we show that environmental gradients predict the ratio of carotenoids to pteridines; carotenoid concentrations are lower and pteridine concentrations higher in arid environments with low vegetation productivity. Both carotenoid and pteridine pigments were present in all species, but only pteridine concentrations explained colour variation among species and there were no correlations between carotenoid and pteridine pigments with similar hue. These results suggest that pteridine pigments replace carotenoids in carotenoid-limited environments, irrespective of skin hue, presumably because it is metabolically cheaper to synthesise pteridines than to acquire and sequester carotenoids when carotenoids are rare.