To change the color of the letter you put them in
[color=#hexColor]colored text[/color]
Like
[color=#FF0000]this text is red[/color]
Say you want the PP in APPLE to be colored.
It would be
A[color=#hexColor]PP[/color]LE
You can use several of the text manipulation expressions and a while event to replace the PP with [color=#hexColor]PP[/color] or you could use the RegEx extension. It has a replace function.
I tested it with a BB text and text input. I used a LastText scene variable to prevent it from being triggered on every frame. This might need some extra checks to prevent weird things like maybe an empty text or something. You need to plan for unexpected results.
The flags for the RegEx are “gi”, you can add or remove them. The g is for global. It matches all occurrences of the search string, the i flag ignores the case.
I kind of tested this backwards. The alphabet string is the source it would be what the user was typing, the input box was the letters to be searched for.
The syntax for search is text to search for like “PP”, the flags, the text that the user types like apple, the replacement text which would be the “PP” inside the color code.
This is more like your game.
Search for PP in the input box and replace with PP surrounded by the color code. You would replace PP with the variable that holds the letter to change the color of. That would be in both places where the PP is. The input object would be replaced with the variable that contains what the player typed.
That’s better. I’m not really familiar with RegEx.
(search text, flags, text to be searched, replacement text)