unity textmeshpro change text color code example
Example: unity change text color
// To change the color of a text, see below
GameObject.GetComponent<Text>().color = Color.black;
// To change the color of a text, see below
GameObject.GetComponent<Text>().color = Color.black;