From 15f363ab3a044a7259433b7fe4ce666210275628 Mon Sep 17 00:00:00 2001 From: Phoenix McAllister <33542651+phoenixmcallister@users.noreply.github.com> Date: Tue, 17 Jul 2018 14:49:40 +1000 Subject: [PATCH] Update format.h --- include/fmt/format.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/fmt/format.h b/include/fmt/format.h index eb0db49c..5e075b4e 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3830,6 +3830,8 @@ struct rgb { void vprint_rgb(rgb fd, string_view format, format_args args); void vprint_rgb(rgb fd, rgb bg, string_view format, format_args args); +void vprint_rgb(rgb fd, wstring_view format, wformat_args args); +void vprint_rgb(rgb fd, rgb bg, wstring_view format, wformat_args args); /** Formats a string and prints it to stdout using ANSI escape sequences to @@ -3842,6 +3844,17 @@ inline void print(rgb fd, string_view format_str, const Args & ... args) { vprint_rgb(fd, format_str, make_format_args(args...)); } +/** + Formats a string and prints it to stdout using ANSI escape sequences to + specify foreground color 'fd'. + Example: + fmt::print(fmt::color::red, L"Elapsed time: {0:.2f} seconds", 1.23); + */ +template +inline void print(rgb fd, wstring_view format_str, const Args & ... args) { + vprint_rgb(fd, format_str, make_format_args(args...)); +} + /** Formats a string and prints it to stdout using ANSI escape sequences to specify foreground color 'fd' and background color 'bg'. @@ -3852,6 +3865,17 @@ template inline void print(rgb fd, rgb bg, string_view format_str, const Args & ... args) { vprint_rgb(fd, bg, format_str, make_format_args(args...)); } + +/** + Formats a string and prints it to stdout using ANSI escape sequences to + specify foreground color 'fd' and background color 'bg'. + Example: + fmt::print(fmt::color::red, fmt::color::black, L"Elapsed time: {0:.2f} seconds", 1.23); + */ +template +inline void print(rgb fd, rgb bg, wstring_view format_str, const Args & ... args) { + vprint_rgb(fd, bg, format_str, make_format_args(args...)); +} #endif // FMT_EXTENDED_COLORS #if FMT_USE_USER_DEFINED_LITERALS