What options do I have to draw on a textarea?
I know some wysiwyg editors that do it. I’m not sure what’s the approach they use, and will have a look at them to understand, but I know that things like tinymce have been around for a while, so I’m guessing there may be more modern approaches these days.
More specifically, what I need is to set the color, or the background color, of a part of text, and sometimes to add some icons.
Here’s a mockup of what I’m envisioning:

Like other form controls, the styling you can apply to a textarea is quite limited. For an example of some styles you can apply, check out this page.
Most WYSIWYG (rich text) editors (e.g. tinyMCE and CKEditor) are using contentEditable on a div or iframe and not a textarea even though it may look like a textarea.