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

coloured console #27

Open
robstoll opened this issue Sep 17, 2019 · 2 comments
Open

coloured console #27

robstoll opened this issue Sep 17, 2019 · 2 comments

Comments

@robstoll
Copy link
Owner

https://stackoverflow.com/questions/5762491/how-to-print-color-in-console-using-system-out-println

I am open for suggestions, the only thing I am opinionated is to use green for checkmarks and red for crosses in summary assertions.

@jGleitz
Copy link
Collaborator

jGleitz commented Sep 17, 2019

I have personally used and would recommend jansi for any kind of escape sequence handling.

It has a nice API and automatically “strips ANSI escape codes if process output is being redirected and not attached to a terminal”.

Note: the application-wide AnsiConsole.systemInstall(); is not necessary. I usually use jansi through their AnsiConsole.out, and thus do not affect anything else.

Edit: I just realized that we are reporting errors through exceptions, not by directly printing them. That means, of course, that we cannot use jansi’s magic directly (we could use AnsiConsole.systemInstall();, though, but I do not like that).

However, we should definitely have logic that can handle the case that we are connected to a sink that does not support ANSI escape codes.

@robstoll
Copy link
Owner Author

In case of Scala we could use additionally
https://github.com/lihaoyi/PPrint

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

No branches or pull requests

2 participants