Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
z
+
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
x
y
+
Typedefs
a
b
c
d
f
h
i
n
o
p
q
r
s
t
u
+
Enumerations
a
c
d
e
f
i
m
n
p
q
r
s
t
u
+
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
z
+
Classes
Class List
Class Hierarchy
+
Class Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
+
Enumerations
a
b
c
d
e
f
g
i
l
m
n
p
r
s
t
u
w
+
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
+
Related Functions
c
e
h
i
m
o
p
q
s
t
v
+
Files
File List
+
File Members
+
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
x
z
+
Variables
a
b
c
e
g
i
l
m
n
p
r
s
t
v
x
y
+
Typedefs
a
b
c
d
e
f
h
i
l
m
n
p
q
r
s
t
u
Enumerator
+
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
src
core
include
corbo-core
text_style.h
Go to the documentation of this file.
1
/*********************************************************************
2
*
3
* Software License Agreement
4
*
5
* Copyright (c) 2020,
6
* TU Dortmund - Institute of Control Theory and Systems Engineering.
7
* All rights reserved.
8
*
9
* This program is free software: you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation, either version 3 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program. If not, see <https://www.gnu.org/licenses/>.
21
*
22
* Authors: Christoph Rösmann
23
*********************************************************************/
24
25
#ifndef SRC_CORE_INCLUDE_CORBO_CORE_TEXT_STYLE_H_
26
#define SRC_CORE_INCLUDE_CORBO_CORE_TEXT_STYLE_H_
27
28
#include <iostream>
29
#include <sstream>
30
#include <string>
31
32
namespace
corbo
{
33
40
enum class
TextColorCode
{
41
FG_DEFAULT
= 39,
42
FG_RED
= 31,
43
FG_GREEN
= 32,
44
FG_BLUE
= 34,
45
FG_BLACK
= 30,
46
FG_YELLOW
= 33,
47
FG_MAGENTA
= 35,
48
FG_CYAN
= 36,
49
FG_LIGHT_GRAY
= 37,
50
FG_DARK_GRAY
= 90,
51
FG_LIGHT_RED
= 91,
52
FG_LIGHT_GREEN
= 92,
53
FG_LIGHT_YELLOW
= 93,
54
FG_LIGHT_BLUE
= 94,
55
FG_LIGHT_MAGENTA
= 95,
56
FG_LIGHT_CYAN
= 96,
57
FG_WHITE
= 97,
58
BG_RED
= 41,
59
BG_GREEN
= 42,
60
BG_BLUE
= 44,
61
BG_DEFAULT
= 49
62
};
63
65
inline
std::ostream&
operator<<
(std::ostream& os,
TextColorCode
code)
66
{
67
#ifdef __linux__
68
return
os <<
"\033["
<<
static_cast<
int
>
(code) <<
"m"
;
69
#else // not supported
70
return
os;
71
#endif
72
}
73
75
inline
std::string
coloredText
(
const
std::string&
text
,
TextColorCode
color)
76
{
77
#ifdef __linux__
78
std::stringstream ss;
79
ss << color << text <<
TextColorCode::FG_DEFAULT
;
80
return
ss.str();
81
#else // not supported
82
return
text
;
83
#endif
84
}
85
}
// namespace corbo
86
87
#endif // SRC_CORE_INCLUDE_CORBO_CORE_TEXT_STYLE_H_
corbo::TextColorCode::FG_LIGHT_CYAN
corbo::TextColorCode::BG_GREEN
corbo::TextColorCode::FG_WHITE
corbo::TextColorCode::FG_LIGHT_RED
corbo::TextColorCode::FG_BLUE
corbo::TextColorCode::FG_DARK_GRAY
corbo::TextColorCode::FG_LIGHT_GREEN
corbo
Definition:
communication/include/corbo-communication/utilities.h:37
corbo::TextColorCode::FG_LIGHT_MAGENTA
corbo::TextColorCode::FG_LIGHT_GRAY
corbo::TextColorCode::FG_LIGHT_YELLOW
corbo::TextColorCode::FG_LIGHT_BLUE
corbo::TextColorCode::BG_DEFAULT
corbo::TextColorCode::FG_YELLOW
corbo::TextColorCode
TextColorCode
Color codes for colored text in consoles/terminals (if supported)
Definition:
text_style.h:40
corbo::TextColorCode::FG_GREEN
corbo::coloredText
std::string coloredText(const std::string &text, TextColorCode color)
Return input text as colored text for terminal output (note: the terminal must support colored text) ...
Definition:
text_style.h:75
corbo::TextColorCode::FG_RED
corbo::TextColorCode::FG_CYAN
corbo::TextColorCode::FG_MAGENTA
corbo::TextColorCode::BG_RED
corbo::TextColorCode::BG_BLUE
relicense.text
text
Definition:
relicense.py:59
corbo::TextColorCode::FG_BLACK
corbo::operator<<
std::ostream & operator<<(std::ostream &os, TextColorCode code)
Output stream operator to change the color of subsequent stream output.
Definition:
text_style.h:65
corbo::TextColorCode::FG_DEFAULT
control_box_rst
Author(s): Christoph Rösmann
autogenerated on Mon Feb 28 2022 22:07:52