PlatformIO Community

Color Messages to Terminal via Serial Monitor

I currently output status messages during arduino development (using vs code) to Platformio’s Terminal via the arduino’s serial monitor print and println commands and everything works just fine. I would like to highlight certain critical messages by prefixing them with a code string that would produce a color message.

Is this possible? If so, would you please point me in the right direction so I could implement color messages to the Platformio terminal.

I notice that when compiling a module, one of the first things to appear on the Platformio Terminal is the module name IN COLOR! - exactly like what I am trying to do. So it seems to be possible. I just don’t know how the module name was produced in color.

Thank you…

Duplicate of Some bizare characters prints on serial monitor with ESP-IDF hello world example – basically you’re looking for how to transmit ANSI color codes from the firmware and have them displayed correctly in the VSCode terminal.

Thanks MAX…

In detail, what I did was append ‘monitor_flags = --raw’ to the end of my platformio,ini, then prefixed the critical messages with “\e[1;31m” and suffixed them with “\e[1;37m” and, voila, red messages…

1 Like