Can I force cygwin to show colors like dos prompt when running GoogleTest?

284 views Asked by At

It is a fact that for terminals that support ascii escape characters, one can use those escapes to colorize a string as described here: ANSI Color Specific RGB Sequence Bash

  std::cout << "\x1b[93;0m " <<  "  this will be colored text! " 
            << "\x1b[0m"     <<  "  this is back to default after reset \n";

My issue: on windows, googletest by default runs and colorized a dos-prompt successfully, but will print gibberish characters when you try to use escape codes that work for Cygwin or Linux. Is there a way to force cygwin to show colors just as the dos prompt does? Or, conversely, to make the dos prompt show colors from escape characters without forcing the user to install things and/or modify system files ?

Note: this is a somewhat related question: GTest's output has no colors when built with cmake+ninja and executed automatically

0

There are 0 answers