Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pPretty detected tty for whether to enable color or not #46

Closed
juhp opened this issue Jul 21, 2019 · 2 comments · Fixed by #47
Closed

pPretty detected tty for whether to enable color or not #46

juhp opened this issue Jul 21, 2019 · 2 comments · Fixed by #47

Comments

@juhp
Copy link
Contributor

juhp commented Jul 21, 2019

For example if one outputs to a pipe, file or Emacs shell-command etc, then the ANSI color control characters are visible , so it would be better to detect whether one is using a TTY terminal or not and depending on that decide whether to enable color or not in the default output.

One can do this by using say https://hackage.haskell.org/package/base-4.12.0.0/docs/System-IO.html#v:hIsTerminalDevice

@cdepillabout cdepillabout changed the title IWBNI pPretty detected tty for whether to enable color or not pPretty detected tty for whether to enable color or not Jul 21, 2019
@cdepillabout
Copy link
Owner

This sounds like a good idea to me. I'd be willing to accept a PR implementing this.

It would also be nice to make it an option so the end user could configure this.

This shouldn't be too hard, so I'll mark it beginner friendly.

@metiulekm
Copy link
Contributor

If nobody else feels like doing so, I will try doing this in the evening (GMT+2).

We should probably add functions that always print colored output, even outside TTYs, and also the tracing functions should somehow do the detection too, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants