Color your terminal's output

Marco Leise Marco.Leise at gmx.de
Sun Oct 9 22:46:52 PDT 2011


Am 09.10.2011, 12:32 Uhr, schrieb Jens Mueller <jens.k.mueller at gmx.de>:

> Johannes Pfau wrote:
>> Jens Mueller wrote:
>> BTW: you could also use isatty (http://linux.die.net/man/3/isatty) to
>> detect if stdout has been redirected and disable color output in that
>> case.
>> For windows:
>> https://forums.embarcadero.com/thread.jspa?threadID=21194
>> or
>> http://msdn.microsoft.com/de-de/library/f4s0ddew(v=vs.80).aspx
>
> Nice idea. Thanks.
>
> Jens

But allow the programmer to force color output anyway. In some cases you  
redirect to a program that itself supports or passes through escape  
sequences. "grep --color=always <regex> <file> | less" would be an example  
of that.


More information about the Digitalmars-d mailing list