Legend title with multiple colours

Hi,

When creating a legend I see you can update the title colour using:

legend = plt.legend(title=‘A, B, C, D’)
plt.setp(legend.get_title(), color=‘red’)

This will change all text in the legend title to red updating the matplotlib Text object. Is there a way to change just part of the substring for the title to a different colour or pass a list of colours for each word/character?

e.g. A, B, and C = black while D is red or A = red, B=green, C=blue, D=purple

This example might be helpful: Rainbow text — Matplotlib 3.6.3 documentation