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

Add --color=yes as argument to get color output #260

Closed
dhoegh opened this issue Jan 18, 2015 · 6 comments
Closed

Add --color=yes as argument to get color output #260

dhoegh opened this issue Jan 18, 2015 · 6 comments

Comments

@dhoegh
Copy link
Contributor

dhoegh commented Jan 18, 2015

It would be nice if the output in IJulia allowed for colors, for an example for the output of @code_warntype. @code_warntype gets colors if --color=yes is added as a startup argument in the ipython_config.py file, but it do not color the error messages which also would be nice.

@stevengj
Copy link
Member

Doesn't julia --color=yes use ANSI escape codes for colored text in a terminal? How are these supposed to work in the browser? (They would work in the IPython console front-end, presumably, but hardly anyone uses that; the most important things are the notebook and qt front ends.)

@dhoegh
Copy link
Contributor Author

dhoegh commented Jan 19, 2015

println("\x1b[31m\"red\"\x1b[0m") seems to print red, you can also see:
http://stackoverflow.com/questions/16816013/is-it-possible-to-print-using-different-color-in-ipythons-notebook

But it seems to be very dark colors compared to the terminal.

@Carreau
Copy link
Contributor

Carreau commented Jan 19, 2015

I wouldn't rely too much on ANSI for in-browser color support, it works but is known to have edge cases,
especially when converting with nbconvert to format that need to strip coloring.

ANSI coloring is also relatively painful when dealing with dark and light background.
It can be worked-around-ish by mapping dark-[a-color]-to light-[same-color], and lots f things like that,
but is always wonky.
It would be much nicer is something like the display system was use to send real html
to the page with actual classes (much like bootstrap) than convey semantic information.

IHaskell do a great job at that, having even a representation for unshowable types.

@IainNZ
Copy link
Member

IainNZ commented Mar 4, 2015

@stevengj does Julia "know" that IJulia is consuming its stdout? Is there some way print_with_color can do something different to the ANSI codes on that basis?

@stevengj
Copy link
Member

stevengj commented Mar 4, 2015

@IainNZ, one option is to do something like how readline is implemented.

This is a bit hacky, though. Ideally, I'd like the warning to call display on an object with writemime methods for text/html etc so that colors would appear automatically for appropriate backends.

@KristofferC
Copy link
Member

Closed by #470?

@stevengj stevengj closed this as completed Jan 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants