Printing color coded printf statements to driver station log

Hey quick question, does anyone know if it’s possible to have print statements print as different colors in the driver station log in c++? I had an idea of color coding messages so you could distinguish them easier.

1 Like

The DriverStation class has error and warning reporting that give yellow and red.

I love watching talks from DEFCON (even though they frequently go over my head) when they get published to youtube every fall, and coloring print statements reminded me of this memorable talk from last year’s conference.

team 100 java code does this with strings like

private static final String kGreen = “\033[1;92m”;
private static final String kRed = “\033[1;91m”;
private static final String kOrange = “\033[38:5:214m”;
private static final String kReset = “\033[0m”;

Hey! For your guy’s color printing does it go directly to the driver station console or to a separate thing?

it goes to the console, though i dimly recall that the driver station embedded console view does not correctly render these ANSI color codes, or the spacing in our little banner, so it doesn’t look right there. both are rendered correctly in the separate window, IIRC.