textEl = textDiv.lastChild
colored = document.createElement('span')
colored.setAttribute('style', <insert css here>) // you can also to e.g. colored.style.backgroundColor = 'properetyvalueasstring' (this is just showing that the property names are camelCase if accessing via object)
textDiv.insertBefore(colored, textEl)
textDiv.removeChild(textEl) // remove user text since you just inserted the colored version