How To make a Ui button Chance colours when pressed

I want a UI button to be able to chance between 3 different colours when it gets pressed/touched, I want it to loop between them forever. I have been looking all over internet for hours but can’t find anything.
I’am very new to both Unity and C#.
Thanks for the help!

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;

   public class ColorChanger: MonoBehaviour
   {            

        List<Color> colors = new List<Color> { Color.red, Color.blue, Color.green };

        int colorIndex = 0;
    
        // Returns next color in the list
        Color GetNextColor()
        {
            // Get the color at colorIndex in the list
            Color nextColor = colors[colorIndex];
    
            // If we are less than the last index
            if (colorIndex < colors.Count - 1)
            {
                // Add one
                colorIndex++;
            }
            else
            {
                // Otherwise restart
                colorIndex = 0;
            }

            // Return the chosen color
            return nextColor;
        }
    
        // Attach this function to OnClick in the inspector
        public void ChangeColor()
        {
            // Set the button's color to GetNextColor();
            GetComponent<Button>().image.color = GetNextColor();
        }
    }

If you press on one of your buttons, there are a variety of options. One of them is “Transition”. You can change the mode from tint (tints the button to whatever colour you want), Sprite swap (allows you to use your images) and animation. Once in any of those modes,just change individual states below it. Good luck.