I have noticed a lot of programs, especially *nix ports, turn off colours when output is redirected. eg, if building something, I often redirect the output like so, "make 2>&1 | tee build.log" which results in no colours in the window or escape sequences in the log and no escape sequences to be seen. Running just make results in GCC outputting colours for errors.
An example from FFmpeg's cmdutils.c for outputting colours,
int show_colors(void *optctx, const char *opt, const char *arg)
{
const char *name;
const uint8_t *rgb;
int i;
printf("%-32s #RRGGBB\n", "name");
for (i = 0; name = av_get_known_color_name(i, &rgb); i++)
printf("%-32s #%02x%02x%02x\n", name, rgb[0], rgb[1], rgb[2]);
return 0;
}
When this was introduced, it just worked on Linux and on OS/2 whereas Windows needed ANSI.SYS or such loaded to work.