Implement styled arguments (#2793)
* Implement styled arguments * Inherit from formatter<Arg> to get the underlying `parse` and `format` * Move styled_arg definition into the previous detail block * Change styled_arg ctor parameters names to avoid shadowing members * Move const before auto * Remove redundant constructor for styled_arg * Use the iterator instead of the buffer in styled_arg::format * Remove unnecessary `styled` overloads * Remove defaulted text_style parameter in styled function
This commit is contained in:
@@ -50,6 +50,12 @@ TEST(color_test, format) {
|
||||
"\x1b[105mtbmagenta\x1b[0m");
|
||||
EXPECT_EQ(fmt::format(fg(fmt::terminal_color::red), "{}", "foo"),
|
||||
"\x1b[31mfoo\x1b[0m");
|
||||
EXPECT_EQ(fmt::format("{}{}", fmt::styled("red", fg(fmt::color::red)),
|
||||
fmt::styled("bold", fmt::emphasis::bold)),
|
||||
"\x1b[38;2;255;000;000mred\x1b[0m\x1b[1mbold\x1b[0m");
|
||||
EXPECT_EQ(fmt::format("{}", fmt::styled("bar", fg(fmt::color::blue) |
|
||||
fmt::emphasis::underline)),
|
||||
"\x1b[4m\x1b[38;2;000;000;255mbar\x1b[0m");
|
||||
}
|
||||
|
||||
TEST(color_test, format_to) {
|
||||
|
||||
Reference in New Issue
Block a user