1 /******************************************************************************
3 * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/) *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License *
7 * as published by the Free Software Foundation; either version 2 *
8 * of the License, or (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software Foundation *
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ******************************************************************************/
23 #include "base/i2-base.hpp"
33 // bit 0-7: foreground
34 Console_ForegroundBlack = 1,
35 Console_ForegroundRed = 2,
36 Console_ForegroundGreen = 3,
37 Console_ForegroundYellow = 4,
38 Console_ForegroundBlue = 5,
39 Console_ForegroundMagenta = 6,
40 Console_ForegroundCyan = 7,
41 Console_ForegroundWhite = 8,
43 // bit 8-15: background
44 Console_BackgroundBlack = 256,
45 Console_BackgroundRed = 266,
46 Console_BackgroundGreen = 267,
47 Console_BackgroundYellow = 268,
48 Console_BackgroundBlue = 269,
49 Console_BackgroundMagenta = 270,
50 Console_BackgroundCyan = 271,
51 Console_BackgroundWhite = 272,
59 Console_Autodetect = -1,
72 ConsoleColorTag(int color, ConsoleType consoleType = Console_Autodetect);
74 friend std::ostream& operator<<(std::ostream& fp, const ConsoleColorTag& cct);
81 std::ostream& operator<<(std::ostream& fp, const ConsoleColorTag& cct);
91 static void DetectType();
93 static void SetType(std::ostream& fp, ConsoleType type);
94 static ConsoleType GetType(std::ostream& fp);
97 static void PrintVT100ColorCode(std::ostream& fp, int color);
99 static void SetWindowsConsoleColor(std::ostream& fp, int color);
108 #endif /* CONSOLE_H */