New function to split text into color coded parts.