-
-
Notifications
You must be signed in to change notification settings - Fork 94
Description
Right now, the colors library is just some functions that wrap their arguments in ANSI escape codes. Unfortunately, this means that it always outputs escape codes, even when situations where this is unsuitable, such as when redirecting to files or using a terminal that doesn't understand escapes. The usual convention is to check for these sorts of situations and turn colorization off (optionally with a flag to override the auto-detection).
I haven't looked into the details of what the standard check entails, I think it involves checking isatty and then consulting terminfo/termcap, or possibly just getting the correct escape code directly with tput. Probably some thought needs to be put into optimizing this to avoid causing performance problems by extraneous calls to the relevant programs.