Stropharia rugosoannulata is a widely distributed edible mushroom rich in nutrients and bioactive compounds with various pharmacological properties. This study explores the mechanism involved in color variation in S. rugosoannulata mushroom cap under different temperature conditions. Transcriptome analysis revealed the role of cytochrome P450 (CYP) gene family members and the flavonoid biosynthesis pathway in color development. The study found that under low-temperature conditions, the expression of key genes in the flavonoid synthesis pathway was upregulated in red varieties, potentially leading to an accumulation of flavonoids and a change in color. Color changes in yellow varieties were related to genes in the terpenoid synthesis pathway. Gene Set Enrichment Analysis (GSEA) highlighted the role of zeaxanthin epoxidase genes in carotenoid synthesis, affecting color formation and possessing photoprotective and antioxidant functions. Additionally, Weighted correlation network analysis, also known as weighted gene co-expression network analysis (WGCNA) analysis revealed the role of C2H2-type transcription factors in color regulation, which may directly or indirectly regulate the genes responsible for pigment synthesis, influencing mushroom color. These factors may directly or indirectly regulate the genes responsible for pigment synthesis, influencing the mushroom color. This research offers insights into the molecular mechanisms underlying color variation in S. rugosoannulata and establishes a foundation for developing varieties in different colors, which could enhance their market appeal and application value in the food industry.