From de37de912bab26ed9a2b97504e65c670889fccd6 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 3 Jul 2019 14:19:24 -0700 Subject: [PATCH] Remove deprecated color API --- include/fmt/color.h | 57 +++------------------------------------------ 1 file changed, 3 insertions(+), 54 deletions(-) diff --git a/include/fmt/color.h b/include/fmt/color.h index f1683a71..ddf27e7c 100644 --- a/include/fmt/color.h +++ b/include/fmt/color.h @@ -12,54 +12,6 @@ FMT_BEGIN_NAMESPACE -#ifdef FMT_DEPRECATED_COLORS - -// color and (v)print_colored are deprecated. -enum FMT_DEPRECATED color { - black, - red, - green, - yellow, - blue, - magenta, - cyan, - white -}; -FMT_DEPRECATED FMT_API void vprint_colored(color c, string_view format, - format_args args); -FMT_DEPRECATED FMT_API void vprint_colored(color c, wstring_view format, - wformat_args args); -template -FMT_DEPRECATED inline void print_colored(color c, string_view format_str, - const Args&... args) { - vprint_colored(c, format_str, make_format_args(args...)); -} -template -FMT_DEPRECATED inline void print_colored(color c, wstring_view format_str, - const Args&... args) { - vprint_colored(c, format_str, make_format_args(args...)); -} - -FMT_DEPRECATED inline void vprint_colored(color c, string_view format, - format_args args) { - char escape[] = "\x1b[30m"; - escape[3] = static_cast('0' + c); - std::fputs(escape, stdout); - vprint(format, args); - std::fputs(internal::data::RESET_COLOR, stdout); -} - -FMT_DEPRECATED inline void vprint_colored(color c, wstring_view format, - wformat_args args) { - wchar_t escape[] = L"\x1b[30m"; - escape[3] = static_cast('0' + c); - std::fputws(escape, stdout); - vprint(format, args); - std::fputws(internal::data::WRESET_COLOR, stdout); -} - -#else - enum class color : uint32_t { alice_blue = 0xF0F8FF, // rgb(240,248,255) antique_white = 0xFAEBD7, // rgb(250,235,215) @@ -221,18 +173,17 @@ enum class terminal_color : uint8_t { bright_magenta, bright_cyan, bright_white -}; // enum class terminal_color +}; enum class emphasis : uint8_t { bold = 1, italic = 1 << 1, underline = 1 << 2, strikethrough = 1 << 3 -}; // enum class emphasis +}; // rgb is a struct for red, green and blue colors. -// We use rgb as name because some editors will show it as color direct in the -// editor. +// Using the name "rgb" makes some editors show the color in a tooltip. struct rgb { FMT_CONSTEXPR rgb() : r(0), g(0), b(0) {} FMT_CONSTEXPR rgb(uint8_t r_, uint8_t g_, uint8_t b_) : r(r_), g(g_), b(b_) {} @@ -629,8 +580,6 @@ inline std::basic_string format(const text_style& ts, const S& format_str, {internal::make_args_checked(format_str, args...)}); } -#endif - FMT_END_NAMESPACE #endif // FMT_COLOR_H_