teditor
1.8.0@@fee5e94
Terminal based editor written in C++
|
Go to the documentation of this file.
4 #include <unordered_map>
25 std::unordered_map<std::string,color_t> amap;
26 std::unordered_map<color_t,std::string> rmap;
38 ColorHelper::get().amap[str] = c;
39 ColorHelper::get().rmap[c] = str;
46 std::unordered_map<std::string,color_t> amap;
47 std::unordered_map<color_t,std::string> rmap;
49 static ColorHelper& get();
76 bool operator==(
const AttrColor& a,
const AttrColor& b);
77 bool operator!=(
const AttrColor& a,
const AttrColor& b);
99 void clear() { colors.clear(); }
105 std::unordered_map<std::string, AttrColor> colors;
109 template <
typename Colors>
111 if(clear) cm.
clear();
112 for(
const auto& ncp : Colors::All) cm.
add(ncp);
std::string color
Definition: colors.h:82
Strings split(const std::string &str, char delim)
Definition: utils.cpp:48
static color_t fromstr(const std::string &str)
Definition: colors.cpp:21
#define ADD(type)
Definition: colors.cpp:9
void clear()
Definition: colors.h:99
void add(const NameColorPair &ncp)
populate the map with the name-color pair At first, the color string is assumed to be another key to ...
Definition: colors.cpp:62
static std::string tostr(color_t attr)
Definition: colors.cpp:28
bool isUnderline() const
Definition: colors.h:70
std::string name
Definition: colors.h:82
bool operator!=(const AttrColor &a, const AttrColor &b)
Definition: colors.cpp:57
void populateColorMap(ColorMap &cm, bool clear=false)
Definition: colors.h:110
void setBold()
Definition: colors.h:66
AttrColor readColor(const std::string &str)
Definition: colors.cpp:74
#define ASSERT(check, fmt,...)
Macro to assert with runtime_error exception if the check fails.
Definition: utils.h:35
AttrHelper()
Definition: colors.cpp:13
bool operator==(const Cell &a, const Cell &b)
Definition: cell_buffer.cpp:33
static const color_t Attr_Underline
Definition: colors.h:15
void set(color_t c, color_t a)
Definition: colors.h:64
static const color_t Attr_Italic
Definition: colors.h:16
bool isBold() const
Definition: colors.h:69
static const color_t Attr_None
Definition: colors.h:13
void setUnderline()
Definition: colors.h:67
void setColor(color_t col)
Definition: colors.h:73
Registrar(const std::string &str, color_t c)
Definition: colors.h:37
static const color_t Mask
Definition: colors.h:59
bool isItalic() const
Definition: colors.h:71
color_t color() const
Definition: colors.h:72
AttrColor()
Definition: colors.h:61
static color_t fromstr(const std::string &str)
Definition: colors.cpp:41
const AttrColor & get(const std::string &name) const
Definition: colors.cpp:67
AttrColor(color_t c, color_t a)
Definition: colors.h:63
AttrColor(color_t in)
Definition: colors.h:62
static const color_t Attr_Bold
Definition: colors.h:14
void clearAttr()
Definition: colors.h:65
void setItalic()
Definition: colors.h:68
static std::string tostr(color_t colo)
Definition: colors.cpp:48
color_t ac
Definition: colors.h:57
uint16_t color_t
Definition: colors.h:11