libxr
Embedded C++ framework for bare-metal, RTOS and Linux
Loading...
Searching...
No Matches
libxr_color.hpp
1#ifndef LIBXR_COLOR_HPP
2#define LIBXR_COLOR_HPP
3
4#include <cstdint>
5
6namespace LibXR
7{
8
14enum class TextStyle : uint8_t
15{
16 NONE = 0,
17 BOLD,
18 DIM,
19 UNDERLINE,
20 BLINK,
21 REVERSE,
22 CONCEALED,
23 COUNT
24};
25
31enum class TerminalControl : uint8_t
32{
33 NONE = 0,
34 RESET,
35 ERASE_LINE,
36 COUNT
37};
38
42enum class Foreground : uint8_t
43{
44 NONE = 0,
45 BLACK,
46 RED,
47 GREEN,
48 YELLOW,
49 BLUE,
50 MAGENTA,
51 CYAN,
52 WHITE,
53 COUNT
54};
55
59enum class Background : uint8_t
60{
61 NONE = 0,
62 BLACK,
63 RED,
64 GREEN,
65 YELLOW,
66 BLUE,
67 MAGENTA,
68 CYAN,
69 WHITE,
70 COUNT
71};
72
78enum class Preset : uint8_t
79{
80 NONE = 0,
81 YELLOW_BOLD,
82 RED_BOLD,
83 BOLD_ON_RED,
84 COUNT
85};
86
90inline constexpr const char* LIBXR_TEXT_STYLE_STR[] = {
91 "", "\033[1m", "\033[2m", "\033[4m", "\033[5m", "\033[7m", "\033[8m"};
92
96inline constexpr const char* LIBXR_TERMINAL_CONTROL_STR[] = {"", "\033[m", "\033[K"};
97
101inline constexpr const char* LIBXR_FOREGROUND_STR[] = {
102 "", "\033[30m", "\033[31m", "\033[32m", "\033[33m",
103 "\033[34m", "\033[35m", "\033[36m", "\033[37m"};
104
108inline constexpr const char* LIBXR_BACKGROUND_STR[] = {
109 "", "\033[40m", "\033[41m", "\033[42m", "\033[43m",
110 "\033[44m", "\033[45m", "\033[46m", "\033[47m"};
111
115inline constexpr const char* LIBXR_PRESET_STR[] = {"", "\033[33m\033[1m",
116 "\033[31m\033[1m", "\033[1m\033[41m"};
117
118} // namespace LibXR
119
120#endif // LIBXR_COLOR_HPP
LibXR 命名空间 / LibXR namespace.
Definition ch32_can.hpp:14
Background
终端背景色 / Terminal background color
constexpr const char * LIBXR_PRESET_STR[]
ANSI转义序列 - 文本预设 / ANSI escape sequences for text presets.
TextStyle
终端文本样式 / Terminal text style
constexpr const char * LIBXR_TERMINAL_CONTROL_STR[]
ANSI转义序列 - 终端控制 / ANSI escape sequences for terminal controls.
constexpr const char * LIBXR_FOREGROUND_STR[]
ANSI转义序列 - 前景色 / ANSI escape sequences for foreground colors.
Foreground
终端前景色 / Terminal foreground color
constexpr const char * LIBXR_BACKGROUND_STR[]
ANSI转义序列 - 背景颜色 / ANSI escape sequences for background color.
constexpr const char * LIBXR_TEXT_STYLE_STR[]
ANSI转义序列 - 文本样式 / ANSI escape sequences for text styles.
TerminalControl
终端控制序列 / Terminal control sequence
Preset
终端文本预设 / Terminal text preset