-
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
Add experimental emphasis support #961
Conversation
I think the number of parameters here isn't going to scale well. I'd suggest creating a single formatting options struct that can be created from a single formatting enum or maybe something like this |
I was thinking about that, but then I decided against it, because I don't know how to differentiate between foreground and background colors. |
Right, good catch. I'm actually not too opposed to something like |
I agree with @foonathan that we should have a single formatting style struct to keep the number of overloads manageable. Using |
And thanks for the PR! This is a cool feature. |
So, I introduced a new class fmt::print(fmt::emphasis::bold | fg(fmt::color::red), "Hello in bold and red\n");
fmt::text_format hackerman = bg(fmt::color::black) | fg(fmt::color::green);
fmt::print(hackerman | fmt::emphasis::bold, "imma hack u\n"); |
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.
Looks great. Just a few smallish comments.
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.
All looks good, only gcc 4.4 looks unhappy: https://travis-ci.org/fmtlib/fmt/jobs/464344769
Merged, thanks! |
@vitaut Can you retroactively add a default constructor for |
Sure, added. |
This patch adds support for text emphasis: bold and underline.