UI Button color

How can I get the color a UI Button has in the moment?

use the following method: your_button_UI.color

For example:

  • Declare a public variable in your script as following:

    //for instance at here we take is an image
    public Image your_image_name;

    //make a public color to show you in the editor what color is your button
    public Color your_image_color;

  • The following line shows the color of the UI image in the editor through the above Color variable:

     your_button_color = your_image_name.color;