Thanks for the info. This is really helpful! 
Are you trying to put colored boxes around sections of a sentence like this 241? (See the “Named entities” part of that Streamlit app)
If so, we’re considering different solutions for this use case right now. Will let you know when we have a more concrete proposal to share!

Also, it looks like you already solved your problem, but in case it helps here’s a Gist 97 showing Ines Montani’s app above was done.