Agora
1.2.0
Agora project
|
Go to the documentation of this file.
15 # define FMT_DEPRECATED_NONMSVC
17 # define FMT_DEPRECATED_NONMSVC FMT_DEPRECATED
203 : r((hex >> 16) & 0xFF), g((hex >> 8) & 0xFF), b(hex & 0xFF) {}
205 : r((uint32_t(hex) >> 16) & 0xFF),
206 g((uint32_t(hex) >> 8) & 0xFF),
207 b(uint32_t(hex) & 0xFF) {}
220 value.rgb_color =
static_cast<uint32_t
>(rgb_color);
223 value.rgb_color = (
static_cast<uint32_t
>(rgb_color.r) << 16) |
224 (
static_cast<uint32_t
>(rgb_color.g) << 8) | rgb_color.b;
228 value.term_color =
static_cast<uint8_t
>(term_color);
243 : set_foreground_color(),
244 set_background_color(),
248 if (!set_foreground_color) {
257 if (!set_background_color) {
266 ems =
static_cast<emphasis>(
static_cast<uint8_t
>(ems) |
267 static_cast<uint8_t
>(rhs.
ems));
278 return and_assign(rhs);
287 return set_foreground_color;
290 return set_background_color;
293 return static_cast<uint8_t
>(ems) != 0;
296 FMT_ASSERT(has_foreground(),
"no foreground specified for this style");
297 return foreground_color;
300 FMT_ASSERT(has_background(),
"no background specified for this style");
301 return background_color;
304 FMT_ASSERT(has_emphasis(),
"no emphasis specified for this style");
311 : set_foreground_color(),
312 set_background_color(),
315 foreground_color = text_color;
316 set_foreground_color =
true;
318 background_color = text_color;
319 set_background_color =
true;
325 if (!set_foreground_color) {
334 if (!set_background_color) {
343 ems =
static_cast<emphasis>(
static_cast<uint8_t
>(ems) &
344 static_cast<uint8_t
>(rhs.
ems));
383 if (!text_color.is_rgb) {
384 bool is_background = esc ==
string_view(
"\x1b[48;2;");
388 if (is_background)
value += 10
u;
406 for (
int i = 0;
i < 7;
i++) {
407 buffer[
i] =
static_cast<Char
>(esc[
i]);
409 rgb color(text_color.value.rgb_color);
413 buffer[19] =
static_cast<Char
>(0);
416 uint8_t em_codes[num_emphases] = {};
417 if (has_emphasis(em, emphasis::bold)) em_codes[0] = 1;
418 if (has_emphasis(em, emphasis::faint)) em_codes[1] = 2;
419 if (has_emphasis(em, emphasis::italic)) em_codes[2] = 3;
420 if (has_emphasis(em, emphasis::underline)) em_codes[3] = 4;
421 if (has_emphasis(em, emphasis::blink)) em_codes[4] = 5;
422 if (has_emphasis(em, emphasis::reverse)) em_codes[5] = 7;
423 if (has_emphasis(em, emphasis::conceal)) em_codes[6] = 8;
424 if (has_emphasis(em, emphasis::strikethrough)) em_codes[7] = 9;
427 for (
size_t i = 0;
i < num_emphases; ++
i) {
428 if (!em_codes[
i])
continue;
444 static constexpr
size_t num_emphases = 8;
449 out[0] =
static_cast<Char
>(
'0' + c / 100);
450 out[1] =
static_cast<Char
>(
'0' + c / 10 % 10);
451 out[2] =
static_cast<Char
>(
'0' + c % 10);
452 out[3] =
static_cast<Char
>(delimiter);
456 return static_cast<uint8_t
>(em) &
static_cast<uint8_t
>(mask);
460 template <
typename Char>
466 template <
typename Char>
472 template <
typename Char>
477 template <
typename Char>
484 std::fputws(chars, stream);
488 fputs(
"\x1b[0m", stream);
492 fputs(L
"\x1b[0m", stream);
495 template <
typename Char>
501 template <
typename Char>
505 bool has_style =
false;
513 auto foreground = detail::make_foreground_color<Char>(ts.
get_foreground());
514 buf.
append(foreground.begin(), foreground.end());
518 auto background = detail::make_background_color<Char>(ts.
get_background());
519 buf.
append(background.begin(), background.end());
522 if (has_style) detail::reset_color<Char>(buf);
527 template <
typename S,
typename Char =
char_t<S>>
547 template <
typename S,
typename... Args,
550 const Args&... args) {
552 fmt::make_args_checked<Args...>(format_str, args...));
566 template <
typename S,
typename... Args,
569 return print(stdout, ts, format_str, args...);
572 template <
typename S,
typename Char =
char_t<S>>
593 template <
typename S,
typename... Args,
typename Char =
char_t<S>>
595 const Args&... args) {
597 fmt::make_args_checked<Args...>(format_str, args...));
603 template <
typename OutputIt,
typename Char,
608 auto&& buf = detail::get_buffer<Char>(out);
625 template <
typename OutputIt,
typename S,
typename... Args,
626 bool enable = detail::is_output_iterator<OutputIt, char_t<S>>
::value&&
632 fmt::make_args_checked<Args...>(format_str, args...));
638 #endif // FMT_COLOR_H_
color
Definition: color.h:23
const SPDLOG_INLINE string_view_t & to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
Definition: common-inl.h:23
typename detail::char_t_impl< S >::type char_t
Definition: core.h:623
basic_string_view< char > string_view
Definition: core.h:540
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:628
terminal_color
Definition: color.h:167
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:573
emphasis get_emphasis() const
Definition: color.h:303
text_style & and_assign(const text_style &rhs)
Definition: color.h:324
std::basic_string< Char > format(const text_style &ts, const S &format_str, const Args &... args)
Definition: color.h:594
void push_back(const T &value)
Definition: core.h:849
uint8_t g
Definition: color.h:209
GeneratorWrapper< T > value(T &&value)
Definition: catch.hpp:3999
emphasis
Definition: color.h:186
void print(const text_style &ts, const S &format_str, const Args &... args)
Definition: color.h:568
void fputs< wchar_t >(const wchar_t *chars, FILE *stream)
Definition: color.h:483
static void to_esc(uint8_t c, Char *out, char delimiter)
Definition: color.h:447
end IFFT Reshape the symbol vector into two different spatial streams length(tx_syms)/NUM_UE
text_style fg(detail::color_type foreground)
Definition: color.h:362
friend text_style operator&(text_style lhs, const text_style &rhs)
Definition: color.h:282
detail::color_type foreground_color
Definition: color.h:354
text_style operator|(emphasis lhs, emphasis rhs)
Definition: color.h:371
void append(const U *begin, const U *end)
emphasis ems
Definition: color.h:358
index
Definition: parse_all_dl.m:11
bool has_emphasis() const
Definition: color.h:292
rgb(uint8_t r_, uint8_t g_, uint8_t b_)
Definition: color.h:201
detail::color_type get_foreground() const
Definition: color.h:295
rgb()
Definition: color.h:200
#define FMT_ENABLE_IF(...)
Definition: core.h:344
rgb(uint32_t hex)
Definition: color.h:202
text_style bg(detail::color_type background)
Definition: color.h:367
text_style(emphasis em=emphasis())
Definition: color.h:242
bool is_rgb
Definition: color.h:230
#define FMT_NOEXCEPT
Definition: core.h:164
void fputs(const Char *chars, FILE *stream)
Definition: color.h:478
uint8_t r
Definition: color.h:208
color_type(terminal_color term_color)
Definition: color.h:226
ansi_color_escape< Char > make_emphasis(emphasis em)
Definition: color.h:473
for i
Definition: generate_data.m:107
#define FMT_END_NAMESPACE
Definition: core.h:240
@ light_golden_rod_yellow
uint8_t b
Definition: color.h:210
auto to_string(const T &value) -> std::string
Definition: format.h:2882
text_style & operator&=(const text_style &rhs)
Definition: color.h:276
Plot Rx waveform for u
Definition: inspect_single_frame.m:108
ansi_color_escape(detail::color_type text_color, const char *esc)
Definition: color.h:379
void reset_color< wchar_t >(FILE *stream)
Definition: color.h:491
color_type(color rgb_color)
Definition: color.h:218
detail::color_type background_color
Definition: color.h:355
detail::color_type get_background() const
Definition: color.h:299
union fmt::v8::detail::color_type::color_union value
#define FMT_CONSTEXPR_CHAR_TRAITS
Definition: core.h:135
const Char * begin() const
Definition: color.h:438
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:605
ansi_color_escape< Char > make_background_color(detail::color_type background)
Definition: color.h:467
void reset_color(buffer< Char > &buffer)
Definition: color.h:496
auto data() -> T *
Definition: core.h:826
ansi_color_escape(emphasis em)
Definition: color.h:415
#define FMT_ASSERT(condition, message)
Definition: core.h:378
#define FMT_BEGIN_DETAIL_NAMESPACE
Definition: core.h:249
#define FMT_MODULE_EXPORT_END
Definition: core.h:248
#define FMT_MODULE_EXPORT_BEGIN
Definition: core.h:247
bool set_background_color
Definition: color.h:357
bool set_foreground_color
Definition: color.h:356
#define FMT_DEPRECATED_NONMSVC
Definition: color.h:17
uint32_t rgb_color
Definition: color.h:233
const Char * end() const
Definition: color.h:439
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:528
color_type(rgb rgb_color)
Definition: color.h:222
friend text_style operator|(text_style lhs, const text_style &rhs)
Definition: color.h:271
#define FMT_BEGIN_NAMESPACE
Definition: core.h:237
constexpr value()
Definition: core.h:1231
typename type_identity< T >::type type_identity_t
Definition: core.h:332
auto get_iterator(Buffer &buf) -> decltype(buf.out())
Definition: core.h:1032
text_style(bool is_foreground, detail::color_type text_color)
Definition: color.h:309
uint8_t term_color
Definition: color.h:232
ansi_color_escape< Char > make_foreground_color(detail::color_type foreground)
Definition: color.h:461
bool has_foreground() const
Definition: color.h:286
text_style & operator|=(const text_style &rhs)
Definition: color.h:247
#define FMT_END_DETAIL_NAMESPACE
Definition: core.h:250
color_type()
Definition: color.h:217
#define FMT_CONSTEXPR
Definition: core.h:110
rgb(color hex)
Definition: color.h:204
type
Definition: core.h:1131
#define FMT_CONSTEXPR_DECL
Definition: core.h:111
bool has_background() const
Definition: color.h:289
static bool has_emphasis(emphasis em, emphasis mask)
Definition: color.h:454