I'm running into an odd issue with color-coded strings, after updating to latest TCOD (was on 8.x.x). Issue persists with both old print_ex() and new con.print() method.
In a nutshell, color coding won't apply properly unless the first letters or symbols in the string are anything but '%c'. It will work fine if anything preceeds '%c%', including whitespace.
Examples:
tcod.console_set_color_control(tcod.COLCTRL_1, colors.pink, bgcolor)
# Will not work:
con.print(x, y, '%cTEST%c' % (tcod.COLCTRL_1, tcod.COLCTRL_STOP))
# Will work:
con.print(x, y, ' ABC %cTEST%c' % (tcod.COLCTRL_1, tcod.COLCTRL_STOP)) # Non-Formatted letters preceeding
con.print(x, y, ' %cTEST%c' % (tcod.COLCTRL_1, tcod.COLCTRL_STOP)) # Whitespace preceeding
# Multiple Colors #
tcod.console_set_color_control(tcod.COLCTRL_1, colors.pink, bgcolor)
tcod.console_set_color_control(tcod.COLCTRL_2, colors.purple, bgcolor)
# Only Test2 colored #
con.print(x, y, '%cTEST%c %cTEST2%c' % (tcod.COLCTRL_1, tcod.COLCTRL_STOP, tcod.COLCTRL_2, tcod.COLCTRL_STOP))
# Both colored #
con.print(x, y, 'ABC %cTEST%c %cTEST2%c' % (tcod.COLCTRL_1, tcod.COLCTRL_STOP, tcod.COLCTRL_2, tcod.COLCTRL_STOP))
I'm running into an odd issue with color-coded strings, after updating to latest TCOD (was on 8.x.x). Issue persists with both old print_ex() and new con.print() method.
In a nutshell, color coding won't apply properly unless the first letters or symbols in the string are anything but '%c'. It will work fine if anything preceeds '%c%', including whitespace.
Examples: