-
Notifications
You must be signed in to change notification settings - Fork 63
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
Colorful printing #181
Comments
Currently, ANSI escape codes will already work, e.g. iter = ProgressBar(1:100)
for i in iter
# ...
set_multiline_postfix(iter, "\u001b[31mred: \u001b[32mgreen\u001b[37m")
end However, this is not a great API to program around and might not work on windows platforms either. I guess the best way to go about this is for ProgressBars.jl to also accept a Just realized that Crayons.jl is by the same author as OhMyREPL.jl, so it's likely what they are using there as well. |
Awesome. Thanks! I didn't realize it would be that simple. I'm happy with that as-is, it seems like this works well and isn't much work at all to interface: for i in iter
set_multiline_postfix(iter, "$(Crayon(foreground=:red))In red: $i$(Crayon(reset=true))")
sleep(0.01)
end It will be cool to have different colors for each column of the output and also for nested expressions! |
Okay that's convenient, I guess we won't need a new API from the ProgressBars.jl side for that then. The ANSI escapes will currently mess up the character-counting for the multiline_postfix: for i in iter
set_multiline_postfix(iter, "$(Crayon(foreground=:red))In red: $i$(Crayon(reset=true))\nsecond line")
sleep(0.01)
end Currently working on fixing that with some regex-magic 😃 |
Just released v1.5.0 that fixes colorful multiline postfixes |
That was fast 🤯 nice work!! |
It could be nice to have colorful printouts of equations, with colored parentheses indicating level of nestedness, similar to OhMyREPL.jl.
@khdlr do you know if ProgressBars.jl
set_multiline_postfix
would support colors?The text was updated successfully, but these errors were encountered: