MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Ansi.hpp
Go to the documentation of this file.
1#pragma once
2
3
4#ifdef MAYAFLUX_PLATFORM_WINDOWS
5#include <windows.h>
6
7#ifdef ERROR
8#undef ERROR
9#endif // ERROR
10
11#endif // MAYAFLUX_PLATFORM_WINDOWS
12
14// Reset
15static constexpr std::string_view Reset = "\033[0m";
16
17// Regular colors
18static constexpr std::string_view Black = "\033[30m";
19static constexpr std::string_view Red = "\033[31m";
20static constexpr std::string_view Green = "\033[32m";
21static constexpr std::string_view Yellow = "\033[33m";
22static constexpr std::string_view Blue = "\033[34m";
23static constexpr std::string_view Magenta = "\033[35m";
24static constexpr std::string_view Cyan = "\033[36m";
25static constexpr std::string_view White = "\033[37m";
26
27// Bright colors
28static constexpr std::string_view BrightRed = "\033[91m";
29static constexpr std::string_view BrightGreen = "\033[92m";
30static constexpr std::string_view BrightYellow = "\033[93m";
31static constexpr std::string_view BrightBlue = "\033[94m";
32static constexpr std::string_view BrightMagenta = "\033[95m";
33static constexpr std::string_view BrightCyan = "\033[96m";
34
35// Background colors
36static constexpr std::string_view BgRed = "\033[41m";
37static constexpr std::string_view BgGreen = "\033[42m";
38static constexpr std::string_view BgYellow = "\033[43m";
39
41{
42#ifdef MAYAFLUX_PLATFORM_WINDOWS
43 HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
44 if (hOut != INVALID_HANDLE_VALUE) {
45 DWORD dwMode = 0;
46 if (GetConsoleMode(hOut, &dwMode)) {
47 return SetConsoleMode(hOut, dwMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
48 }
49 }
50 return false;
51#else
52 return true;
53#endif
54}
55
56}
static constexpr std::string_view BrightYellow
Definition Ansi.hpp:30
static constexpr std::string_view Yellow
Definition Ansi.hpp:21
static constexpr std::string_view BrightBlue
Definition Ansi.hpp:31
static constexpr std::string_view White
Definition Ansi.hpp:25
static constexpr std::string_view Blue
Definition Ansi.hpp:22
static constexpr std::string_view BrightGreen
Definition Ansi.hpp:29
static constexpr std::string_view Reset
Definition Ansi.hpp:15
static constexpr std::string_view BgGreen
Definition Ansi.hpp:37
static constexpr std::string_view Green
Definition Ansi.hpp:20
static constexpr std::string_view BgRed
Definition Ansi.hpp:36
static constexpr std::string_view BrightMagenta
Definition Ansi.hpp:32
static constexpr std::string_view Red
Definition Ansi.hpp:19
static constexpr std::string_view Black
Definition Ansi.hpp:18
static constexpr std::string_view Cyan
Definition Ansi.hpp:24
static constexpr std::string_view BrightRed
Definition Ansi.hpp:28
static bool initialize_console_colors()
Definition Ansi.hpp:40
static constexpr std::string_view BrightCyan
Definition Ansi.hpp:33
static constexpr std::string_view Magenta
Definition Ansi.hpp:23
static constexpr std::string_view BgYellow
Definition Ansi.hpp:38