dealing with text codes, specifically color

What function on the window base would I call to pass something like:

"\c[3]Sample Text\c[0] example txt."in and get back the text transformed so I can then pass it to this.drawtext() ?
convertEscapeCharacters


However, there are two types of message codes: codes that control message behavior, and codes that are meant to be placeholders/variables.


The convert method only works for the variables.


\c for example changes the font color, so you would need to retain that information.
convertEscapeCharacters

However, there are two types of message codes: codes that control message behavior, and codes that are meant to be placeholders/variables.

The convert method only works for the variables.

\c for example changes the font color, so you would need to retain that information.
well this piece of string is being passed in via a plugin parameter and when I call the method you supplied above (on window base) it just returns the string, no color changed, escaped.

I see what your saying about variables. Is there any where I can look or an example fucntion of how to change colors?
well this piece of string is being passed in via a plugin parameter and when I call the method you supplied above (on window base) it just returns the string, no color changed, escaped.

I see what your saying about variables. Is there any where I can look or an example fucntion of how to change colors?
Look at how base window handles color in strings.

Code:
Window_Base.prototype.processEscapeCharacter = function(code, textState) {    switch (code) {    case 'C':        this.changeTextColor(this.textColor(this.obtainEscapeParam(textState)));        break;    case 'I':        this.processDrawIcon(this.obtainEscapeParam(textState), textState);        break;    case '{':        this.makeFontBigger();        break;    case '}':        this.makeFontSmaller();        break;    }};
Window_Base.drawTextEx(text, x, y)

parses character codes and prints the text on the window contents.

Original thread: https://forums.rpgmakerweb.com/threads/dealing-with-text-codes-specifically-color.47889/