The petals of Medicago sativa ssp. sativa and M. sativa ssp. falcata are purple and yellow, respectively. Free hybridization between M. sativa ssp. sativa and M. sativa ssp. falcata has created hybrids with various flower colors in nature. Moreover, the flower colors of alfalfa are closely correlated with yield, nutritional quality, stress tolerance and other agronomic characteristics. To elucidate the underlying mechanisms of flower color formation in M. sativa ssp. sativa and M. sativa ssp. falcata, we conducted an integrative analysis of the transcriptome and metabolome of alfalfa with three different petal colors (purple, yellow and cream). The metabolic profiles suggested that anthocyanins and carotenoids are the crucial pigments in purple and yellow flowers, respectively. A quantitative exploration of the anthocyanin and carotenoid components indicated that the accumulations of cyanidin, delphinidin, peonidin, malvidin, pelargonidin and petunidin derivatives are significantly higher in purple flowers than in cream flowers. In addition, the content of carotenes (phytoene, α-carotene and β-carotene) and xanthophylls (α-cryptoxanthin, lutein, β-cryptoxanthin, zeaxanthin, antheraxanthin and violaxanthin derivatives) was markedly higher in yellow flowers than in cream flowers. Furthermore, we found that delphinidin-3,5-O-diglucoside and lutein were the predominant pigments accumulated in purple and yellow flowers, respectively. The transcriptomic results revealed that twenty-five upregulated structural genes (one C4H, three 4CL, twelve CHS, two CHI, one F3H, one F3'H, one F3'5'H and four DFR) are involved in the accumulation of anthocyanins in purple flowers, and nine structural genes (two PSY, one ZDS, two CRTISO, two BCH, one ZEP and one ECH) exert an effect on the carotenoid biosynthesis pathway in yellow flowers. The findings of this study reveal the underlying mechanisms of anthocyanin and carotenoid biosynthesis in alfalfa with three classic flower colors.