There is an own gradient text option in TextMeshPro package. But it doesn’t work properly for my task. TMP gradient applies for each character in text, and it looks like this:
But for my task, gradient should be filed for all text, from left to right. So, I’ve wrote custom script, that gets gradient colors form text component and apply it for all text. And now it looks like this:
The trick is simple: divide gradient for characters count and then, in order, apply our ranges for each characters.
This article is translation from my blog: https://mopsicus.ru. I will try to translate and write here more often if you like post as this.