how to change ui text color in unity 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;