bostrom/text-to-image

Possibility to change color of text parts

Opened this issue · 3 comments

Hi,

for an important project I need to change the color of parts of the submitted text. Is this possible? If yes, how?

Regards
John

Hi @Johnny99211, no unfortunately it's not possible to change color of only parts of the text at the moment. But it's a nice feature idea.

Can you just give me a short hint how this can be done? I need to make a prototyp for a munich car manifacturer. We maybe want to use your library if this function would exists since this is main part of our requirement.

It would require some new syntax for specifying inline style overrides and a way to translate that into styles on the canvas context. But not only that, it would also require to paint each section of differently styled text onto the canvas separately, which requires more measuring and calculations.

So it's doable, but not trivial. Something in the lines of this, but maybe not as elaborate. https://stackoverflow.com/a/43904751