How can I control the color gradient of a text in Text Mesh Pro?

Hi!

I’m trying to change the color gradient of text using text mesh pro. However, I can’t find a way to make it work.

   `VertexGradient textGradient = text.colorGradient;
    textGradient.bottomLeft = new Color32(255, 185, 0, 255);
    textGradient.bottomRight = new Color32(255, 84, 84, 255);
    textGradient.topLeft = new Color32(255, 49, 96, 255);
    textGradient.topRight = new Color32 (255, 0, 0, 255);`

Any tips on how can I do this via script?
Thanks!

text.colorGradient = textGradient;