SUNphi  1.0
TextFormat.hpp
Go to the documentation of this file.
1 #ifndef _TEXT_FORMAT_HPP
2 #define _TEXT_FORMAT_HPP
3 
4 /// \file TextFormat.hpp
5 ///
6 /// \brief Define format to print on the terminal
7 ///
8 /// See https://www.growingwiththeweb.com/2015/05/colours-in-gnome-terminal.html
9 
10 namespace SUNphi
11 {
12  /// First part of the string which change color
13  [[ maybe_unused ]]
14  static constexpr char TEXT_CHANGE_COLOR_HEAD[]=
15  "\x1b[3";
16 
17  /// Last part of the string whcih change color
18  [[ maybe_unused ]]
19  static constexpr char TEXT_CHANGE_COLOR_TAIL[]=
20  "m";
21 
22  /// Identifier of the various supported colors
23  enum class TextColor : char {BLACK='0',
24  RED='1',
25  GREEN='2',
26  BROWN='3',
27  BLUE='4',
28  PURPLE='5',
29  CYAN='6',
30  GREY='7',
31  DEFAULT='9'};
32 
33 
34  /// First part of the string which change style
35  [[ maybe_unused ]]
36  static constexpr char TEXT_CHANGE_STYLE_HEAD[]=
37  "\x1b[";
38 
39  /// Last part of the string whcih change style
40  [[ maybe_unused ]]
41  static constexpr char TEXT_CHANGE_STYLE_TAIL[]=
42  "m";
43 
44  /// Identifier of the various supported styles
45  enum class TextStyle : char {RESET='0',
46  BOLD='1',
47  DIM='2',
48  ITALIC='3',
49  UNDERLINE='4',
50  BLINK='5',
51  REVERSE='7',
52  HIDDEN='8',
53  STRIKETHROUGH='9'};
54 }
55 
56 #endif