MV color escape character

Hello Coders,

this bit is a kind of a riddle how to fix it as there is no code that has \c[n] in the convert characters
or process characters.

while I got this code working mostly, it also include "\c[n]" which causing shifts
JavaScript:
        let labelTxt = this._labelText;
        this.contents.clear();
        this.createContents();
        let wy = this.lineHeight();
        let MultilineText = labelTxt.split("\\n");
        for(let i = 0; i < MultilineText.length; i++) {
            this.drawText(MultilineText[i].trim(), 0, wy * i, this.contents.width, "center");
        }

and while it works nicely and color showing up, the color code isn't converted.
as seen in the image below.
colorCode.png


so what can I do to make this fix?

I cannot use this.content.color which is the way used for textColor color.

but no convertCharacter is found, so unsure how to fix this issue, any idea?

REMINDER:
drawText doesn't draw escapeCharacter by default or has alignment, and drawTextEx does,
but same issue if I use that, but far more textOffset by than, this is in use of TSR_TextColorAddon
to make sure drawText can use icon, colors like drawTextEx does.
It's probably easier to call "changeTextColor(colorAsRgba)" method before.

MV:
Code:
this.changeTextColor(this.textColor(2));
this.drawText(...);

MZ:
Code:
this.changeTextColor(ColorManager.textColor(2));
this.drawText(...);
It's probably easier to call "changeTextColor(colorAsRgba)" method before.
those are called inside the game through notetags.

I had a different method before that worked, but this way is smaller, faster,
and cleaner to support multiple lined.

while its max 3, it needs another approach to make this work?
while the height doesn't fix as well, I use a label offset in the comment too
so it work out.

I just need to find out how \c[n] is called and from where exactly as I hoped
it was inside convertCharacter like \v[n] does, so it just erase that part, and show
it value, so how is it done through \c[n]?

Edit:
figure out it did work, but add spaces when used like:
\c[n]Text to be done\c[0]\n\c[12]new line of text this is because TSR_TextColorAddon
only required \c to cancel out the color and stops the shifting.

I kind of forgotten that which make cancel and recolor when required faster.
I feel stupid when not used it in a while 😀
there is no code that has \c[n] in the convert characters
or process characters.
The \c text code is handled by the processEscapeCharacter method of Window_Base (rpg_windows.js, lines 364~379). Same thing applies to the other mid-message text codes: \i, \{, and \}.

drawText doesn't draw escapeCharacter by default or has alignment, and drawTextEx does,
but same issue if I use that, but far more textOffset by than, this is in use of TSR_TextColorAddon
to make sure drawText can use icon, colors like drawTextEx does.
By default drawTextEx is only left-aligned, so I assume the shift you're seeing is due to whatever plugin is aligning the text-code text. It looks like it is aligning based on the full width including text codes? That may be due a plugin conflict (perhaps because of load order), or a bug in one or more plugins.
The \c text code is handled by the processEscapeCharacter method of Window_Base (rpg_windows.js, lines 364~379). Same thing applies to the other mid-message text codes: \i, \{, and \}.
Couldn't find it, but solved it as exit color is slightly different in use to avoid this issue 😉
This thread is closed due to being reported as solved. If you need it reopened, report it to let us know. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/color-escape-character.177221/