rsalmei/alive-progress

ANSI color escape codes not working/supported

Lvicek07 opened this issue · 2 comments

When I try to implement ANSI colour, it just shows the code, doesn't change colour.

title = '\033[93m', "Synchronizing", '\033[91m'
...
bar = alive_it(packet_list, title=title, dual_line=True)

Output: ('\x1b[93m', 'Synchronizing', '\x1b[91m') |████████████████████████████████████████| 11/11 [100%] in 5.5s (2.00/s)

By using the comma syntax when you're making a variable, you're making a tuple. That's what's getting printed out. A tuple is like a list/array, but it's faster and can't be modified.

Try title = '\033[93m' + "Synchronizing" + '\033[91m' or even title = '\033[93mSynchronizing\033[91m'

Hey, thanks @TheTechRobo.

Yep, that's exactly it @Lvicek07, I'm not sure why would you create a tuple for passing such values, but when you pass the correct ones, embedded on the title string, it does work:

Screen.Recording.2023-03-14.at.22.43.56.mov

And it actually is a good idea! I liked the effect 👍