How to make a simple text markup in HTML? [closed]

Is there a way I could add my own text markup?

What I mean by this is for e.g. I have an input field, and when I type a word for e.g. “apple” that word will be green, but if I type “orange” it will be the color orange.

Long story short, each word I type in the input field is a different color (which I will pre-set in my code)?

Is it possible to do this?