如何在发布文本时更改文本的颜色? [HTML]

i'm working with my simple coding tutorial for our software engineering class project. How can i change the color of the text of the reserve word in programming for example is I entered some text in the <textarea> like this.

public class Dog{


}

because public and class is a reserve word in java, the plain black color from the textarea will be changed to blue and red when it is posted.

Thank you!