votca 2024.2-dev
Loading...
Searching...
No Matches
colors.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18#ifndef __VOTCA_TOOLS_COLORS_H
19#define __VOTCA_TOOLS_COLORS_H
20
21namespace votca {
22namespace tools {
23
39namespace Colors {
40static const char Empty[] = {0};
41
42static const char Reset[] = {0x1b, '[', '0', ';', '3', '9', 'm', 0};
43
44static const char Black[] = {0x1b, '[', '0', ';', '3', '0', 'm', 0};
45static const char Red[] = {0x1b, '[', '0', ';', '3', '1', 'm', 0};
46static const char Green[] = {0x1b, '[', '0', ';', '3', '2', 'm', 0};
47static const char Yellow[] = {0x1b, '[', '0', ';', '3', '3', 'm', 0};
48static const char Blue[] = {0x1b, '[', '0', ';', '3', '4', 'm', 0};
49static const char Magenta[] = {0x1b, '[', '0', ';', '3', '5', 'm', 0};
50static const char Cyan[] = {0x1b, '[', '0', ';', '3', '6', 'm', 0};
51static const char White[] = {0x1b, '[', '0', ';', '3', '7', 'm', 0};
52
53static const char BoldBlack[] = {0x1b, '[', '1', ';', '3', '0', 'm', 0};
54static const char BoldRed[] = {0x1b, '[', '1', ';', '3', '1', 'm', 0};
55static const char BoldGreen[] = {0x1b, '[', '1', ';', '3', '2', 'm', 0};
56static const char BoldYellow[] = {0x1b, '[', '1', ';', '3', '3', 'm', 0};
57static const char BoldBlue[] = {0x1b, '[', '1', ';', '3', '4', 'm', 0};
58static const char BoldMagenta[] = {0x1b, '[', '1', ';', '3', '5', 'm', 0};
59static const char BoldCyan[] = {0x1b, '[', '1', ';', '3', '6', 'm', 0};
60static const char BoldWhite[] = {0x1b, '[', '1', ';', '3', '7', 'm', 0};
61
62} // namespace Colors
63
65 public:
66 virtual const char *reset() const = 0;
67 virtual const char *black() const = 0;
68 virtual const char *red() const = 0;
69 virtual const char *green() const = 0;
70 virtual const char *yellow() const = 0;
71 virtual const char *blue() const = 0;
72 virtual const char *magenta() const = 0;
73 virtual const char *cyan() const = 0;
74 virtual const char *white() const = 0;
75};
76
78 public:
79 virtual const char *Reset() const = 0;
80 virtual const char *Black() const = 0;
81 virtual const char *Red() const = 0;
82 virtual const char *Green() const = 0;
83 virtual const char *Yellow() const = 0;
84 virtual const char *Blue() const = 0;
85 virtual const char *Magenta() const = 0;
86 virtual const char *Cyan() const = 0;
87 virtual const char *White() const = 0;
88 virtual ~ColorSchemeBase() = default;
89};
90
91template <typename TColorScheme>
92class Color final : public ColorSchemeBase {
93 TColorScheme cs_;
94
95 public:
96 const char *Reset() const { return cs_.reset(); }
97 const char *Black() const { return cs_.black(); }
98 const char *Red() const { return cs_.red(); }
99 const char *Green() const { return cs_.green(); }
100 const char *Yellow() const { return cs_.yellow(); }
101 const char *Blue() const { return cs_.blue(); }
102 const char *Magenta() const { return cs_.magenta(); }
103 const char *Cyan() const { return cs_.cyan(); }
104 const char *White() const { return cs_.white(); }
105};
106
107class csDefault final : public ColorScheme {
108 public:
109 const char *reset() const { return Colors::Empty; }
110 const char *black() const { return Colors::Empty; }
111 const char *red() const { return Colors::Empty; }
112 const char *green() const { return Colors::Empty; }
113 const char *yellow() const { return Colors::Empty; }
114 const char *blue() const { return Colors::Empty; }
115 const char *magenta() const { return Colors::Empty; }
116 const char *cyan() const { return Colors::Empty; }
117 const char *white() const { return Colors::Empty; }
118};
119
120class csRGB final : public ColorScheme {
121 public:
122 const char *reset() const { return Colors::Reset; }
123 const char *black() const { return Colors::Black; }
124 const char *red() const { return Colors::Red; }
125 const char *green() const { return Colors::Green; }
126 const char *yellow() const { return Colors::Yellow; }
127 const char *blue() const { return Colors::Blue; }
128 const char *magenta() const { return Colors::Magenta; }
129 const char *cyan() const { return Colors::Cyan; }
130 const char *white() const { return Colors::White; }
131};
132
133extern Color<csDefault> DEFAULT_COLORS;
134
135} // namespace tools
136} // namespace votca
137
138#endif /* __VOTCA_TOOLS_COLORS_H */
virtual const char * Black() const =0
virtual const char * Yellow() const =0
virtual const char * Green() const =0
virtual const char * White() const =0
virtual const char * Red() const =0
virtual ~ColorSchemeBase()=default
virtual const char * Blue() const =0
virtual const char * Cyan() const =0
virtual const char * Reset() const =0
virtual const char * Magenta() const =0
virtual const char * black() const =0
virtual const char * white() const =0
virtual const char * green() const =0
virtual const char * reset() const =0
virtual const char * blue() const =0
virtual const char * cyan() const =0
virtual const char * yellow() const =0
virtual const char * magenta() const =0
virtual const char * red() const =0
const char * Reset() const
Definition colors.h:96
TColorScheme cs_
Definition colors.h:93
const char * Red() const
Definition colors.h:98
const char * Magenta() const
Definition colors.h:102
const char * Green() const
Definition colors.h:99
const char * Yellow() const
Definition colors.h:100
const char * Black() const
Definition colors.h:97
const char * White() const
Definition colors.h:104
const char * Cyan() const
Definition colors.h:103
const char * Blue() const
Definition colors.h:101
const char * green() const
Definition colors.h:112
const char * reset() const
Definition colors.h:109
const char * blue() const
Definition colors.h:114
const char * white() const
Definition colors.h:117
const char * magenta() const
Definition colors.h:115
const char * cyan() const
Definition colors.h:116
const char * black() const
Definition colors.h:110
const char * yellow() const
Definition colors.h:113
const char * red() const
Definition colors.h:111
const char * red() const
Definition colors.h:124
const char * yellow() const
Definition colors.h:126
const char * black() const
Definition colors.h:123
const char * cyan() const
Definition colors.h:129
const char * blue() const
Definition colors.h:127
const char * magenta() const
Definition colors.h:128
const char * white() const
Definition colors.h:130
const char * reset() const
Definition colors.h:122
const char * green() const
Definition colors.h:125
static const char BoldCyan[]
Definition colors.h:59
static const char Empty[]
Definition colors.h:40
static const char Blue[]
Definition colors.h:48
static const char Cyan[]
Definition colors.h:50
static const char White[]
Definition colors.h:51
static const char Magenta[]
Definition colors.h:49
static const char BoldBlue[]
Definition colors.h:57
static const char BoldYellow[]
Definition colors.h:56
static const char Red[]
Definition colors.h:45
static const char BoldBlack[]
Definition colors.h:53
static const char Reset[]
Definition colors.h:42
static const char Black[]
Definition colors.h:44
static const char BoldRed[]
Definition colors.h:54
static const char BoldMagenta[]
Definition colors.h:58
static const char Yellow[]
Definition colors.h:47
static const char Green[]
Definition colors.h:46
static const char BoldWhite[]
Definition colors.h:60
static const char BoldGreen[]
Definition colors.h:55
Color< csDefault > DEFAULT_COLORS
Definition colors.cc:24
base class for all analysis tools
Definition basebead.h:33