SoPlex Documentation
Loading...
Searching...
No Matches
color.h
Go to the documentation of this file.
1// Formatting library for C++ - color support
2//
3// Copyright (c) 2018 - present, Victor Zverovich and fmt contributors
4// All rights reserved.
5//
6// For the license information refer to format.h.
7
8#ifndef FMT_COLOR_H_
9#define FMT_COLOR_H_
10
11#include "format.h"
12
14
15enum class color : uint32_t {
16 alice_blue = 0xF0F8FF, // rgb(240,248,255)
17 antique_white = 0xFAEBD7, // rgb(250,235,215)
18 aqua = 0x00FFFF, // rgb(0,255,255)
19 aquamarine = 0x7FFFD4, // rgb(127,255,212)
20 azure = 0xF0FFFF, // rgb(240,255,255)
21 beige = 0xF5F5DC, // rgb(245,245,220)
22 bisque = 0xFFE4C4, // rgb(255,228,196)
23 black = 0x000000, // rgb(0,0,0)
24 blanched_almond = 0xFFEBCD, // rgb(255,235,205)
25 blue = 0x0000FF, // rgb(0,0,255)
26 blue_violet = 0x8A2BE2, // rgb(138,43,226)
27 brown = 0xA52A2A, // rgb(165,42,42)
28 burly_wood = 0xDEB887, // rgb(222,184,135)
29 cadet_blue = 0x5F9EA0, // rgb(95,158,160)
30 chartreuse = 0x7FFF00, // rgb(127,255,0)
31 chocolate = 0xD2691E, // rgb(210,105,30)
32 coral = 0xFF7F50, // rgb(255,127,80)
33 cornflower_blue = 0x6495ED, // rgb(100,149,237)
34 cornsilk = 0xFFF8DC, // rgb(255,248,220)
35 crimson = 0xDC143C, // rgb(220,20,60)
36 cyan = 0x00FFFF, // rgb(0,255,255)
37 dark_blue = 0x00008B, // rgb(0,0,139)
38 dark_cyan = 0x008B8B, // rgb(0,139,139)
39 dark_golden_rod = 0xB8860B, // rgb(184,134,11)
40 dark_gray = 0xA9A9A9, // rgb(169,169,169)
41 dark_green = 0x006400, // rgb(0,100,0)
42 dark_khaki = 0xBDB76B, // rgb(189,183,107)
43 dark_magenta = 0x8B008B, // rgb(139,0,139)
44 dark_olive_green = 0x556B2F, // rgb(85,107,47)
45 dark_orange = 0xFF8C00, // rgb(255,140,0)
46 dark_orchid = 0x9932CC, // rgb(153,50,204)
47 dark_red = 0x8B0000, // rgb(139,0,0)
48 dark_salmon = 0xE9967A, // rgb(233,150,122)
49 dark_sea_green = 0x8FBC8F, // rgb(143,188,143)
50 dark_slate_blue = 0x483D8B, // rgb(72,61,139)
51 dark_slate_gray = 0x2F4F4F, // rgb(47,79,79)
52 dark_turquoise = 0x00CED1, // rgb(0,206,209)
53 dark_violet = 0x9400D3, // rgb(148,0,211)
54 deep_pink = 0xFF1493, // rgb(255,20,147)
55 deep_sky_blue = 0x00BFFF, // rgb(0,191,255)
56 dim_gray = 0x696969, // rgb(105,105,105)
57 dodger_blue = 0x1E90FF, // rgb(30,144,255)
58 fire_brick = 0xB22222, // rgb(178,34,34)
59 floral_white = 0xFFFAF0, // rgb(255,250,240)
60 forest_green = 0x228B22, // rgb(34,139,34)
61 fuchsia = 0xFF00FF, // rgb(255,0,255)
62 gainsboro = 0xDCDCDC, // rgb(220,220,220)
63 ghost_white = 0xF8F8FF, // rgb(248,248,255)
64 gold = 0xFFD700, // rgb(255,215,0)
65 golden_rod = 0xDAA520, // rgb(218,165,32)
66 gray = 0x808080, // rgb(128,128,128)
67 green = 0x008000, // rgb(0,128,0)
68 green_yellow = 0xADFF2F, // rgb(173,255,47)
69 honey_dew = 0xF0FFF0, // rgb(240,255,240)
70 hot_pink = 0xFF69B4, // rgb(255,105,180)
71 indian_red = 0xCD5C5C, // rgb(205,92,92)
72 indigo = 0x4B0082, // rgb(75,0,130)
73 ivory = 0xFFFFF0, // rgb(255,255,240)
74 khaki = 0xF0E68C, // rgb(240,230,140)
75 lavender = 0xE6E6FA, // rgb(230,230,250)
76 lavender_blush = 0xFFF0F5, // rgb(255,240,245)
77 lawn_green = 0x7CFC00, // rgb(124,252,0)
78 lemon_chiffon = 0xFFFACD, // rgb(255,250,205)
79 light_blue = 0xADD8E6, // rgb(173,216,230)
80 light_coral = 0xF08080, // rgb(240,128,128)
81 light_cyan = 0xE0FFFF, // rgb(224,255,255)
82 light_golden_rod_yellow = 0xFAFAD2, // rgb(250,250,210)
83 light_gray = 0xD3D3D3, // rgb(211,211,211)
84 light_green = 0x90EE90, // rgb(144,238,144)
85 light_pink = 0xFFB6C1, // rgb(255,182,193)
86 light_salmon = 0xFFA07A, // rgb(255,160,122)
87 light_sea_green = 0x20B2AA, // rgb(32,178,170)
88 light_sky_blue = 0x87CEFA, // rgb(135,206,250)
89 light_slate_gray = 0x778899, // rgb(119,136,153)
90 light_steel_blue = 0xB0C4DE, // rgb(176,196,222)
91 light_yellow = 0xFFFFE0, // rgb(255,255,224)
92 lime = 0x00FF00, // rgb(0,255,0)
93 lime_green = 0x32CD32, // rgb(50,205,50)
94 linen = 0xFAF0E6, // rgb(250,240,230)
95 magenta = 0xFF00FF, // rgb(255,0,255)
96 maroon = 0x800000, // rgb(128,0,0)
97 medium_aquamarine = 0x66CDAA, // rgb(102,205,170)
98 medium_blue = 0x0000CD, // rgb(0,0,205)
99 medium_orchid = 0xBA55D3, // rgb(186,85,211)
100 medium_purple = 0x9370DB, // rgb(147,112,219)
101 medium_sea_green = 0x3CB371, // rgb(60,179,113)
102 medium_slate_blue = 0x7B68EE, // rgb(123,104,238)
103 medium_spring_green = 0x00FA9A, // rgb(0,250,154)
104 medium_turquoise = 0x48D1CC, // rgb(72,209,204)
105 medium_violet_red = 0xC71585, // rgb(199,21,133)
106 midnight_blue = 0x191970, // rgb(25,25,112)
107 mint_cream = 0xF5FFFA, // rgb(245,255,250)
108 misty_rose = 0xFFE4E1, // rgb(255,228,225)
109 moccasin = 0xFFE4B5, // rgb(255,228,181)
110 navajo_white = 0xFFDEAD, // rgb(255,222,173)
111 navy = 0x000080, // rgb(0,0,128)
112 old_lace = 0xFDF5E6, // rgb(253,245,230)
113 olive = 0x808000, // rgb(128,128,0)
114 olive_drab = 0x6B8E23, // rgb(107,142,35)
115 orange = 0xFFA500, // rgb(255,165,0)
116 orange_red = 0xFF4500, // rgb(255,69,0)
117 orchid = 0xDA70D6, // rgb(218,112,214)
118 pale_golden_rod = 0xEEE8AA, // rgb(238,232,170)
119 pale_green = 0x98FB98, // rgb(152,251,152)
120 pale_turquoise = 0xAFEEEE, // rgb(175,238,238)
121 pale_violet_red = 0xDB7093, // rgb(219,112,147)
122 papaya_whip = 0xFFEFD5, // rgb(255,239,213)
123 peach_puff = 0xFFDAB9, // rgb(255,218,185)
124 peru = 0xCD853F, // rgb(205,133,63)
125 pink = 0xFFC0CB, // rgb(255,192,203)
126 plum = 0xDDA0DD, // rgb(221,160,221)
127 powder_blue = 0xB0E0E6, // rgb(176,224,230)
128 purple = 0x800080, // rgb(128,0,128)
129 rebecca_purple = 0x663399, // rgb(102,51,153)
130 red = 0xFF0000, // rgb(255,0,0)
131 rosy_brown = 0xBC8F8F, // rgb(188,143,143)
132 royal_blue = 0x4169E1, // rgb(65,105,225)
133 saddle_brown = 0x8B4513, // rgb(139,69,19)
134 salmon = 0xFA8072, // rgb(250,128,114)
135 sandy_brown = 0xF4A460, // rgb(244,164,96)
136 sea_green = 0x2E8B57, // rgb(46,139,87)
137 sea_shell = 0xFFF5EE, // rgb(255,245,238)
138 sienna = 0xA0522D, // rgb(160,82,45)
139 silver = 0xC0C0C0, // rgb(192,192,192)
140 sky_blue = 0x87CEEB, // rgb(135,206,235)
141 slate_blue = 0x6A5ACD, // rgb(106,90,205)
142 slate_gray = 0x708090, // rgb(112,128,144)
143 snow = 0xFFFAFA, // rgb(255,250,250)
144 spring_green = 0x00FF7F, // rgb(0,255,127)
145 steel_blue = 0x4682B4, // rgb(70,130,180)
146 tan = 0xD2B48C, // rgb(210,180,140)
147 teal = 0x008080, // rgb(0,128,128)
148 thistle = 0xD8BFD8, // rgb(216,191,216)
149 tomato = 0xFF6347, // rgb(255,99,71)
150 turquoise = 0x40E0D0, // rgb(64,224,208)
151 violet = 0xEE82EE, // rgb(238,130,238)
152 wheat = 0xF5DEB3, // rgb(245,222,179)
153 white = 0xFFFFFF, // rgb(255,255,255)
154 white_smoke = 0xF5F5F5, // rgb(245,245,245)
155 yellow = 0xFFFF00, // rgb(255,255,0)
156 yellow_green = 0x9ACD32 // rgb(154,205,50)
157}; // enum class color
158
159enum class terminal_color : uint8_t {
160 black = 30,
161 red,
162 green,
163 yellow,
164 blue,
165 magenta,
166 cyan,
167 white,
168 bright_black = 90,
176};
177
178enum class emphasis : uint8_t {
179 bold = 1,
180 italic = 1 << 1,
181 underline = 1 << 2,
182 strikethrough = 1 << 3
183};
184
185// rgb is a struct for red, green and blue colors.
186// Using the name "rgb" makes some editors show the color in a tooltip.
187struct rgb {
188 FMT_CONSTEXPR rgb() : r(0), g(0), b(0) {}
189 FMT_CONSTEXPR rgb(uint8_t r_, uint8_t g_, uint8_t b_) : r(r_), g(g_), b(b_) {}
190 FMT_CONSTEXPR rgb(uint32_t hex)
191 : r((hex >> 16) & 0xFF), g((hex >> 8) & 0xFF), b(hex & 0xFF) {}
193 : r((uint32_t(hex) >> 16) & 0xFF),
194 g((uint32_t(hex) >> 8) & 0xFF),
195 b(uint32_t(hex) & 0xFF) {}
196 uint8_t r;
197 uint8_t g;
198 uint8_t b;
199};
200
201namespace detail {
202
203// color is a struct of either a rgb color or a terminal color.
207 value{} {
208 value.rgb_color = static_cast<uint32_t>(rgb_color);
209 }
211 value.rgb_color = (static_cast<uint32_t>(rgb_color.r) << 16) |
212 (static_cast<uint32_t>(rgb_color.g) << 8) | rgb_color.b;
213 }
215 value{} {
216 value.term_color = static_cast<uint8_t>(term_color);
217 }
218 bool is_rgb;
220 uint8_t term_color;
221 uint32_t rgb_color;
223};
224} // namespace detail
225
226// Experimental text formatting support.
228 public:
233
238 } else if (rhs.set_foreground_color) {
240 FMT_THROW(format_error("can't OR a terminal color"));
242 }
243
247 } else if (rhs.set_background_color) {
249 FMT_THROW(format_error("can't OR a terminal color"));
251 }
252
253 ems = static_cast<emphasis>(static_cast<uint8_t>(ems) |
254 static_cast<uint8_t>(rhs.ems));
255 return *this;
256 }
257
259 const text_style& rhs) {
260 return lhs |= rhs;
261 }
262
267 } else if (rhs.set_foreground_color) {
269 FMT_THROW(format_error("can't AND a terminal color"));
271 }
272
276 } else if (rhs.set_background_color) {
278 FMT_THROW(format_error("can't AND a terminal color"));
280 }
281
282 ems = static_cast<emphasis>(static_cast<uint8_t>(ems) &
283 static_cast<uint8_t>(rhs.ems));
284 return *this;
285 }
286
288 const text_style& rhs) {
289 return lhs &= rhs;
290 }
291
299 return static_cast<uint8_t>(ems) != 0;
300 }
302 FMT_ASSERT(has_foreground(), "no foreground specified for this style");
303 return foreground_color;
304 }
306 FMT_ASSERT(has_background(), "no background specified for this style");
307 return background_color;
308 }
310 FMT_ASSERT(has_emphasis(), "no emphasis specified for this style");
311 return ems;
312 }
313
314 private:
315 FMT_CONSTEXPR text_style(bool is_foreground,
319 ems() {
320 if (is_foreground) {
321 foreground_color = text_color;
323 } else {
324 background_color = text_color;
326 }
327 }
328
333
339};
340
342 return text_style(/*is_foreground=*/true, foreground);
343}
344
346 return text_style(/*is_foreground=*/false, background);
347}
348
352
353namespace detail {
354
355template <typename Char> struct ansi_color_escape {
357 const char* esc) FMT_NOEXCEPT {
358 // If we have a terminal color, we need to output another escape code
359 // sequence.
360 if (!text_color.is_rgb) {
361 bool is_background = esc == detail::data::background_color;
362 uint32_t value = text_color.value.term_color;
363 // Background ASCII codes are the same as the foreground ones but with
364 // 10 more.
365 if (is_background) value += 10u;
366
367 size_t index = 0;
368 buffer[index++] = static_cast<Char>('\x1b');
369 buffer[index++] = static_cast<Char>('[');
370
371 if (value >= 100u) {
372 buffer[index++] = static_cast<Char>('1');
373 value %= 100u;
374 }
375 buffer[index++] = static_cast<Char>('0' + value / 10u);
376 buffer[index++] = static_cast<Char>('0' + value % 10u);
377
378 buffer[index++] = static_cast<Char>('m');
379 buffer[index++] = static_cast<Char>('\0');
380 return;
381 }
382
383 for (int i = 0; i < 7; i++) {
384 buffer[i] = static_cast<Char>(esc[i]);
385 }
386 rgb color(text_color.value.rgb_color);
387 to_esc(color.r, buffer + 7, ';');
388 to_esc(color.g, buffer + 11, ';');
389 to_esc(color.b, buffer + 15, 'm');
390 buffer[19] = static_cast<Char>(0);
391 }
393 uint8_t em_codes[4] = {};
394 uint8_t em_bits = static_cast<uint8_t>(em);
395 if (em_bits & static_cast<uint8_t>(emphasis::bold)) em_codes[0] = 1;
396 if (em_bits & static_cast<uint8_t>(emphasis::italic)) em_codes[1] = 3;
397 if (em_bits & static_cast<uint8_t>(emphasis::underline)) em_codes[2] = 4;
398 if (em_bits & static_cast<uint8_t>(emphasis::strikethrough))
399 em_codes[3] = 9;
400
401 size_t index = 0;
402 for (int i = 0; i < 4; ++i) {
403 if (!em_codes[i]) continue;
404 buffer[index++] = static_cast<Char>('\x1b');
405 buffer[index++] = static_cast<Char>('[');
406 buffer[index++] = static_cast<Char>('0' + em_codes[i]);
407 buffer[index++] = static_cast<Char>('m');
408 }
409 buffer[index++] = static_cast<Char>(0);
410 }
411 FMT_CONSTEXPR operator const Char*() const FMT_NOEXCEPT { return buffer; }
412
413 FMT_CONSTEXPR const Char* begin() const FMT_NOEXCEPT { return buffer; }
414 FMT_CONSTEXPR const Char* end() const FMT_NOEXCEPT {
415 return buffer + std::char_traits<Char>::length(buffer);
416 }
417
418 private:
419 Char buffer[7u + 3u * 4u + 1u];
420
421 static FMT_CONSTEXPR void to_esc(uint8_t c, Char* out,
422 char delimiter) FMT_NOEXCEPT {
423 out[0] = static_cast<Char>('0' + c / 100);
424 out[1] = static_cast<Char>('0' + c / 10 % 10);
425 out[2] = static_cast<Char>('0' + c % 10);
426 out[3] = static_cast<Char>(delimiter);
427 }
428};
429
430template <typename Char>
435
436template <typename Char>
441
442template <typename Char>
446
447template <typename Char>
448inline void fputs(const Char* chars, FILE* stream) FMT_NOEXCEPT {
449 std::fputs(chars, stream);
450}
451
452template <>
453inline void fputs<wchar_t>(const wchar_t* chars, FILE* stream) FMT_NOEXCEPT {
454 std::fputws(chars, stream);
455}
456
457template <typename Char> inline void reset_color(FILE* stream) FMT_NOEXCEPT {
459}
460
461template <> inline void reset_color<wchar_t>(FILE* stream) FMT_NOEXCEPT {
463}
464
465template <typename Char>
467 const char* begin = data::reset_color;
468 const char* end = begin + sizeof(data::reset_color) - 1;
469 buffer.append(begin, end);
470}
471
472template <typename Char>
473void vformat_to(buffer<Char>& buf, const text_style& ts,
474 basic_string_view<Char> format_str,
476 bool has_style = false;
477 if (ts.has_emphasis()) {
478 has_style = true;
480 buf.append(emphasis.begin(), emphasis.end());
481 }
482 if (ts.has_foreground()) {
483 has_style = true;
485 buf.append(foreground.begin(), foreground.end());
486 }
487 if (ts.has_background()) {
488 has_style = true;
490 buf.append(background.begin(), background.end());
491 }
492 detail::vformat_to(buf, format_str, args);
493 if (has_style) detail::reset_color<Char>(buf);
494}
495} // namespace detail
496
497template <typename S, typename Char = char_t<S>>
498void vprint(std::FILE* f, const text_style& ts, const S& format,
502 buf.push_back(Char(0));
503 detail::fputs(buf.data(), f);
504}
505
506/**
507 \rst
508 Formats a string and prints it to the specified file stream using ANSI
509 escape sequences to specify text formatting.
510
511 **Example**::
512
513 fmt::print(fmt::emphasis::bold | fg(fmt::color::red),
514 "Elapsed time: {0:.2f} seconds", 1.23);
515 \endrst
516 */
517template <typename S, typename... Args,
519void print(std::FILE* f, const text_style& ts, const S& format_str,
520 const Args&... args) {
521 vprint(f, ts, format_str,
522 fmt::make_args_checked<Args...>(format_str, args...));
523}
524
525/**
526 Formats a string and prints it to stdout using ANSI escape sequences to
527 specify text formatting.
528 Example:
529 fmt::print(fmt::emphasis::bold | fg(fmt::color::red),
530 "Elapsed time: {0:.2f} seconds", 1.23);
531 */
532template <typename S, typename... Args,
534void print(const text_style& ts, const S& format_str, const Args&... args) {
535 return print(stdout, ts, format_str, args...);
536}
537
538template <typename S, typename Char = char_t<S>>
539inline std::basic_string<Char> vformat(
540 const text_style& ts, const S& format_str,
543 detail::vformat_to(buf, ts, to_string_view(format_str), args);
544 return fmt::to_string(buf);
545}
546
547/**
548 \rst
549 Formats arguments and returns the result as a string using ANSI
550 escape sequences to specify text formatting.
551
552 **Example**::
553
554 #include <fmt/color.h>
555 std::string message = fmt::format(fmt::emphasis::bold | fg(fmt::color::red),
556 "The answer is {}", 42);
557 \endrst
558*/
559template <typename S, typename... Args, typename Char = char_t<S>>
560inline std::basic_string<Char> format(const text_style& ts, const S& format_str,
561 const Args&... args) {
562 return vformat(ts, to_string_view(format_str),
563 fmt::make_args_checked<Args...>(format_str, args...));
564}
565
566/**
567 Formats a string with the given text_style and writes the output to ``out``.
568 */
569template <typename OutputIt, typename Char,
571OutputIt vformat_to(
572 OutputIt out, const text_style& ts, basic_string_view<Char> format_str,
574 decltype(detail::get_buffer<Char>(out)) buf(detail::get_buffer_init(out));
575 detail::vformat_to(buf, ts, format_str, args);
576 return detail::get_iterator(buf);
577}
578
579/**
580 \rst
581 Formats arguments with the given text_style, writes the result to the output
582 iterator ``out`` and returns the iterator past the end of the output range.
583
584 **Example**::
585
586 std::vector<char> out;
587 fmt::format_to(std::back_inserter(out),
588 fmt::emphasis::bold | fg(fmt::color::red), "{}", 42);
589 \endrst
590*/
591template <typename OutputIt, typename S, typename... Args,
594inline auto format_to(OutputIt out, const text_style& ts, const S& format_str,
595 Args&&... args) ->
596 typename std::enable_if<enable, OutputIt>::type {
597 return vformat_to(out, ts, to_string_view(format_str),
598 fmt::make_args_checked<Args...>(format_str, args...));
599}
600
602
603#endif // FMT_COLOR_H_
T * data() FMT_NOEXCEPT
Definition core.h:712
void append(const U *begin, const U *end)
Definition format.h:600
void push_back(const T &value)
Definition core.h:735
constexpr FMT_INLINE value(int val=0)
Definition core.h:1071
friend FMT_CONSTEXPR_DECL text_style bg(detail::color_type background) FMT_NOEXCEPT
Definition color.h:345
FMT_CONSTEXPR text_style(bool is_foreground, detail::color_type text_color) FMT_NOEXCEPT
Definition color.h:315
FMT_CONSTEXPR bool has_foreground() const FMT_NOEXCEPT
Definition color.h:292
friend FMT_CONSTEXPR text_style operator|(text_style lhs, const text_style &rhs)
Definition color.h:258
FMT_CONSTEXPR detail::color_type get_foreground() const FMT_NOEXCEPT
Definition color.h:301
emphasis ems
Definition color.h:338
FMT_CONSTEXPR bool has_emphasis() const FMT_NOEXCEPT
Definition color.h:298
bool set_foreground_color
Definition color.h:336
friend FMT_CONSTEXPR_DECL text_style fg(detail::color_type foreground) FMT_NOEXCEPT
Definition color.h:341
detail::color_type foreground_color
Definition color.h:334
FMT_CONSTEXPR text_style(emphasis em=emphasis()) FMT_NOEXCEPT
Definition color.h:229
detail::color_type background_color
Definition color.h:335
FMT_CONSTEXPR text_style & operator|=(const text_style &rhs)
Definition color.h:234
FMT_CONSTEXPR emphasis get_emphasis() const FMT_NOEXCEPT
Definition color.h:309
FMT_CONSTEXPR text_style & operator&=(const text_style &rhs)
Definition color.h:263
friend FMT_CONSTEXPR text_style operator&(text_style lhs, const text_style &rhs)
Definition color.h:287
bool set_background_color
Definition color.h:337
FMT_CONSTEXPR bool has_background() const FMT_NOEXCEPT
Definition color.h:295
FMT_CONSTEXPR detail::color_type get_background() const FMT_NOEXCEPT
Definition color.h:305
void print(std::FILE *f, const text_style &ts, const S &format_str, const Args &... args)
Definition color.h:519
OutputIt vformat_to(OutputIt out, const text_style &ts, basic_string_view< Char > format_str, basic_format_args< buffer_context< type_identity_t< Char > > > args)
Definition color.h:571
auto format_to(OutputIt out, const text_style &ts, const S &format_str, Args &&... args) -> typename std::enable_if< enable, OutputIt >::type
Definition color.h:594
FMT_CONSTEXPR text_style operator|(emphasis lhs, emphasis rhs) FMT_NOEXCEPT
Definition color.h:349
emphasis
Definition color.h:178
terminal_color
Definition color.h:159
color
Definition color.h:15
@ steel_blue
@ misty_rose
@ cadet_blue
@ saddle_brown
@ papaya_whip
@ lavender
@ blue_violet
@ dark_blue
@ mint_cream
@ medium_purple
@ gainsboro
@ sea_green
@ olive_drab
@ fire_brick
@ deep_pink
@ white_smoke
@ deep_sky_blue
@ ghost_white
@ medium_aquamarine
@ aquamarine
@ chartreuse
@ royal_blue
@ lawn_green
@ dark_slate_blue
@ dark_gray
@ dark_violet
@ medium_turquoise
@ light_cyan
@ medium_spring_green
@ dark_salmon
@ antique_white
@ dark_sea_green
@ pale_green
@ pale_golden_rod
@ light_coral
@ dark_orchid
@ dodger_blue
@ old_lace
@ dark_green
@ light_pink
@ light_blue
@ light_salmon
@ navajo_white
@ spring_green
@ light_sky_blue
@ lime_green
@ alice_blue
@ rosy_brown
@ pale_turquoise
@ rebecca_purple
@ medium_blue
@ light_yellow
@ dim_gray
@ powder_blue
@ light_gray
@ blanched_almond
@ midnight_blue
@ lemon_chiffon
@ indian_red
@ golden_rod
@ slate_blue
@ dark_golden_rod
@ forest_green
@ light_sea_green
@ floral_white
@ medium_slate_blue
@ sandy_brown
@ dark_red
@ hot_pink
@ dark_magenta
@ yellow_green
@ dark_orange
@ light_steel_blue
@ pale_violet_red
@ dark_olive_green
@ cornflower_blue
@ light_slate_gray
@ dark_cyan
@ light_green
@ chocolate
@ medium_sea_green
@ sky_blue
@ burly_wood
@ honey_dew
@ green_yellow
@ light_golden_rod_yellow
@ lavender_blush
@ moccasin
@ turquoise
@ medium_orchid
@ dark_khaki
@ dark_slate_gray
@ peach_puff
@ medium_violet_red
@ orange_red
@ cornsilk
@ sea_shell
@ slate_gray
@ dark_turquoise
std::basic_string< Char > format(const text_style &ts, const S &format_str, const Args &... args)
Definition color.h:560
FMT_CONSTEXPR text_style bg(detail::color_type background) FMT_NOEXCEPT
Definition color.h:345
std::basic_string< Char > vformat(const text_style &ts, const S &format_str, basic_format_args< buffer_context< type_identity_t< Char > > > args)
Definition color.h:539
void vprint(std::FILE *f, const text_style &ts, const S &format, basic_format_args< buffer_context< type_identity_t< Char > > > args)
Definition color.h:498
FMT_CONSTEXPR text_style fg(detail::color_type foreground) FMT_NOEXCEPT
Definition color.h:341
#define FMT_ASSERT(condition, message)
Definition core.h:292
typename detail::char_t_impl< S >::type char_t
Definition core.h:540
#define FMT_CONSTEXPR
Definition core.h:98
#define FMT_BEGIN_NAMESPACE
Definition core.h:203
basic_string_view< Char > to_string_view(const Char *s)
Definition core.h:468
#define FMT_ENABLE_IF(...)
Definition core.h:277
typename type_identity< T >::type type_identity_t
Definition core.h:270
#define FMT_END_NAMESPACE
Definition core.h:198
#define FMT_NOEXCEPT
Definition core.h:139
#define FMT_CONSTEXPR_DECL
Definition core.h:99
#define FMT_THROW(x)
Definition format.h:116
FMT_CONSTEXPR ansi_color_escape< Char > make_background_color(detail::color_type background) FMT_NOEXCEPT
Definition color.h:437
void reset_color(FILE *stream) FMT_NOEXCEPT
Definition color.h:457
FMT_CONSTEXPR ansi_color_escape< Char > make_emphasis(emphasis em) FMT_NOEXCEPT
Definition color.h:443
void vformat_to(buffer< Char > &buf, const text_style &ts, basic_string_view< Char > format_str, basic_format_args< buffer_context< type_identity_t< Char > > > args)
Definition color.h:473
FMT_CONSTEXPR ansi_color_escape< Char > make_foreground_color(detail::color_type foreground) FMT_NOEXCEPT
Definition color.h:431
iterator_buffer< OutputIt, T > get_buffer(OutputIt)
void fputs< wchar_t >(const wchar_t *chars, FILE *stream) FMT_NOEXCEPT
Definition color.h:453
OutputIt get_buffer_init(OutputIt out)
Definition core.h:880
void fputs(const Char *chars, FILE *stream) FMT_NOEXCEPT
Definition color.h:448
auto get_iterator(Buffer &buf) -> decltype(buf.out())
Definition core.h:888
void reset_color< wchar_t >(FILE *stream) FMT_NOEXCEPT
Definition color.h:461
FMT_CONSTEXPR const Char * begin() const FMT_NOEXCEPT
Definition color.h:413
FMT_CONSTEXPR const Char * end() const FMT_NOEXCEPT
Definition color.h:414
FMT_CONSTEXPR ansi_color_escape(detail::color_type text_color, const char *esc) FMT_NOEXCEPT
Definition color.h:356
Char buffer[7u+3u *4u+1u]
Definition color.h:419
FMT_CONSTEXPR ansi_color_escape(emphasis em) FMT_NOEXCEPT
Definition color.h:392
static FMT_CONSTEXPR void to_esc(uint8_t c, Char *out, char delimiter) FMT_NOEXCEPT
Definition color.h:421
static const char foreground_color[]
Definition format.h:887
static const wchar_t wreset_color[5]
Definition format.h:890
static const char reset_color[5]
Definition format.h:889
static const char background_color[]
Definition format.h:888
FMT_CONSTEXPR color_type(rgb rgb_color) FMT_NOEXCEPT
Definition color.h:210
union detail::color_type::color_union value
FMT_CONSTEXPR color_type(color rgb_color) FMT_NOEXCEPT
Definition color.h:206
FMT_CONSTEXPR color_type() FMT_NOEXCEPT
Definition color.h:205
FMT_CONSTEXPR color_type(terminal_color term_color) FMT_NOEXCEPT
Definition color.h:214
Definition color.h:187
uint8_t g
Definition color.h:197
uint8_t b
Definition color.h:198
uint8_t r
Definition color.h:196
FMT_CONSTEXPR rgb(color hex)
Definition color.h:192
FMT_CONSTEXPR rgb(uint8_t r_, uint8_t g_, uint8_t b_)
Definition color.h:189
FMT_CONSTEXPR rgb(uint32_t hex)
Definition color.h:190
FMT_CONSTEXPR rgb()
Definition color.h:188