-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Deprecate print_with_color #25522
Deprecate print_with_color #25522
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is certainly an improvement. I wonder if it wouldn't make more sense to just have a generic Style(content, color=:cyan, bold=true)
wrapper for content – where the content could be a bare string or another Style
object or whatever and then you just call print
on that. @KristofferC may have some thoughts as the author of Crayons...
28ffa96
to
02bebf4
Compare
The If we change |
Should we just import (steal) parts of Crayons to replace this? |
I can make a PR with a suggestion (after I have moved out REPL to stdlib). The name "Crayons" is perhaps a bit too cute for an stdlib but it could easily be renamed to something more descriptive. |
Something that's been suggested was to wrap the I/O argument in |
It doesn't fully make sense to me that formatting style would be part of the IO context. |
Let's just rename this to |
Triage dixit: go with this PR (rename to |
02bebf4
to
1092f83
Compare
This deprecates print_with_color in favor of printstyled, which accepts the color as a keyword argument.
1092f83
to
97e2054
Compare
CI summary:
|
the `needs_news` tag can be removed from JuliaLang#25522
In the future could |
* adds `printstyled` to NEWS.md the `needs_news` tag can be removed from #25522 * fixes `printstyled` trailing whitespace in NEWS.md
* adds `printstyled` to NEWS.md the `needs_news` tag can be removed from #25522 * fixes `printstyled` trailing whitespace in NEWS.md
print_with_color
is an odd function; its name is rife with underscores and it violates our argument order conventions by putting the color before the I/O argument.This PR replaces
print_with_color
with a more general function calledprintstyled
, which accepts the color as a keyword argument to mimic thebold
keyword. That is,print_with_color(:red, "hi", bold=true)
is nowprintstyled("hi", color=:red, bold=true)
.There was also an unexported
Base.println_with_color
, which has been removed entirely without deprecation.