-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Can we have print_color and println_color? #10327
Comments
How about a color=true keyword argument for the print and println functions? Or is that a bad idea performance-wise? |
Sorry, ignore my uninformed comment... |
It seems like a perfectly reasonable comment to me! (am I missing something?) Generally underscores are unsatisfying. |
Keyword argument sounds good too. I'll make a PR in that style |
Great. Rather than color=true, I guess it would be rather color=:blue Any chance we could also allow the spelling colour...? ;) |
@dpsanders What would happen if you specify both? |
|
I don't think that a keyword argument would be practical. Since there's no dispatch on keyword arguments, every reimplementation of println(with_color(:blue, "Hello World!)) ( with_color(println, :blue, "Hello World!") ( This second syntax allows do blocks, which can be useful syntax. Something like this already works: Base.with_output_color(:blue, STDOUT) do io
println(io, "Hello World")
end |
@TotalVerb I like your thinking there! @vtjnash has been thinking about passing that type of information with higher-level |
yep. this is another issue that #13825 would solve (and is very similar to what @TotalVerb described) |
Now Implemented as |
Title says it all really. We currently have just
print_with_color
which is verbose and almost every time I've used it I've wanted to have a new line. Hence my "request". I will even invest the 10 hours required myself to make the PR ;)The text was updated successfully, but these errors were encountered: