change button and text color together

It is possibile with a script attached to text of a button change the color of the two elements together?
I am using the new UI system.

S.

Are you referring to the “fade” effect that you get when hovering or clicking a button? If so, you could just make a script that gets the current color of the button and applies it to the color of the text.

If you mean just changing the color of the two elements at the same time, you could make a script that has a specific color, and apply that color to the two elements (if the script is on the Text gameObject, you could have the button as a variable, or call transform.parent.GetComponent())