-
Notifications
You must be signed in to change notification settings - Fork 2.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
Implement styled arguments #2793
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.
Thanks for the PR! Overall looks good but please rebase past the CI fix and address inline comments.
Everything should be solved now! |
Thank you! |
Could you also add it to the docs (https://github.com/fmtlib/fmt/blob/master/doc/api.rst)? |
Sure! |
Hello,
this PR implements a way to apply different styles to different arguments in a single
format
(orprint
) call.It is done by introducing a new function,
fmt::styled
, which takes an argument of arbitrary type and a color, anemphasis
or atext_style
, and creates a wrapper around the argument that will be formatted it in the requested style.A simple example of usage: