John C. answered 04/21/20
BS and MS in Comp Sci, 34 years experience, 3 yrs CS tutoring
You can output colored text to a terminal by writing an ANSI color value. The ANSI Red value is shown below (sorry, it's C, but can be easily translated):
const char* ANSI_RED = "\x1b[31m";
You can look up other colors online (e.g., ANSI_GREEN). There is also an ANSI_RESET to undo whatever color setting you have put in place.