blob: 99afbd342784e5eafdee3ce39e9b30048a191022 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#pragma once
#include "colors.h"
// Note: this is an old interface for printing colors to stream.
// Consider printing elements of `EAnsiCode` directly.
namespace NColorizer {
typedef TStringBuf (TColors::*TColorFunc)() const;
struct TColorHandle {
const TColors* C;
TColorFunc F;
inline TColorHandle(const TColors* c, TColorFunc f) noexcept
: C(c)
, F(f)
{
}
};
#define DEF(X) \
static inline TColorHandle X() noexcept { \
return TColorHandle(&StdErr(), &TColors::X##Color); \
}
DEF(Old)
DEF(Black)
DEF(Green)
DEF(Cyan)
DEF(Red)
DEF(Purple)
DEF(Brown)
DEF(LightGray)
DEF(DarkGray)
DEF(LightBlue)
DEF(LightGreen)
DEF(LightCyan)
DEF(LightRed)
DEF(LightPurple)
DEF(Yellow)
DEF(White)
#undef DEF
}
|