-
Notifications
You must be signed in to change notification settings - Fork 2.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
Add support for builtin terminal colors. #974
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.
Looks good but please separate terminal color and rgb. Thanks for the PR!
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.
A few more comments.
gcc 4.4 is unhappy because it doesn't support unrestricted unions. |
FMT_CONSTEXPR color_type() FMT_NOEXCEPT | ||
: is_rgb(), value{} {} | ||
FMT_CONSTEXPR color_type(color rgb_color) FMT_NOEXCEPT | ||
: is_rgb(true), value{} { |
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.
Why call value{}
if it is initialized below?
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.
That was some another attempt to fix gcc 4.4 that we don't need anymore :). I'll remove it.
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.
@vitaut Nevermind my previous comment. They are initialized because they have to be for constexpr
and it seems like VS2013 doesn't implement directly initializing the union in a member initializer list. So I have to leave it like it is :(
53c5264
to
d72b67e
Compare
Merged, thanks! |
@Rakete1111, could you please review the updated CONTIBUTING document, particularly the part about licensing, and let me know if you agree with it being applied both to your contributions to {fmt}? The library is likely to be relicensed (#1073) so I'm collecting approval from all earlier contributors. Thanks! |
Fixes #968. This PR adds a
terminal_color
enum:fmt::print(fg(fmt::terminal_color::red), "stop\n");