Console Library 4.7.0
A header-only library that makes C++ simple
Loading...
Searching...
No Matches
colorful.h
Go to the documentation of this file.
1
8
9/*
10Copyright (c) 2026 MrXie1109
11
12Permission is hereby granted, free of charge, to any person obtaining a copy
13of this software and associated documentation files (the "Software"), to deal
14in the Software without restriction, including without limitation the rights
15to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16copies of the Software, and to permit persons to whom the Software is
17furnished to do so, subject to the following conditions:
18
19The above copyright notice and this permission notice shall be included in all
20copies or substantial portions of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28SOFTWARE.
29*/
30
31#pragma once
32
33namespace console
34{
40 namespace color
41 {
42 // ------------------------------ 前景色 ------------------------------
44 const char *Black = "\033[30m";
46 const char *Red = "\033[31m";
48 const char *Green = "\033[32m";
50 const char *Yellow = "\033[33m";
52 const char *Blue = "\033[34m";
54 const char *Magenta = "\033[35m";
56 const char *Cyan = "\033[36m";
58 const char *White = "\033[37m";
60 const char *BrightBlack = "\033[90m";
62 const char *BrightRed = "\033[91m";
64 const char *BrightGreen = "\033[92m";
66 const char *BrightYellow = "\033[93m";
68 const char *BrightBlue = "\033[94m";
70 const char *BrightMagenta = "\033[95m";
72 const char *BrightCyan = "\033[96m";
74 const char *BrightWhite = "\033[97m";
76 const char *Reset = "\033[0m";
77
78 // ------------------------------ 背景色 ------------------------------
80 const char *BgBlack = "\033[40m";
82 const char *BgRed = "\033[41m";
84 const char *BgGreen = "\033[42m";
86 const char *BgYellow = "\033[43m";
88 const char *BgBlue = "\033[44m";
90 const char *BgMagenta = "\033[45m";
92 const char *BgCyan = "\033[46m";
94 const char *BgWhite = "\033[47m";
96 const char *BgBrightBlack = "\033[100m";
98 const char *BgBrightRed = "\033[101m";
100 const char *BgBrightGreen = "\033[102m";
102 const char *BgBrightYellow = "\033[103m";
104 const char *BgBrightBlue = "\033[104m";
106 const char *BgBrightMagenta = "\033[105m";
108 const char *BgBrightCyan = "\033[106m";
110 const char *BgBrightWhite = "\033[107m";
111
112 // ------------------------------ 文本样式 ------------------------------
114 const char *Bold = "\033[1m";
116 const char *Dim = "\033[2m";
118 const char *Italic = "\033[3m";
120 const char *Underline = "\033[4m";
122 const char *Blink = "\033[5m";
124 const char *Reverse = "\033[7m";
126 const char *Hidden = "\033[8m";
128 const char *Strikethrough = "\033[9m";
129 }
130}
包含控制台颜色、背景色和文本样式的 ANSI 转义序列常量。
const char * BgBrightYellow
亮黄色背景
Definition colorful.h:102
const char * Blink
闪烁
Definition colorful.h:122
const char * BgCyan
青色背景
Definition colorful.h:92
const char * Bold
粗体
Definition colorful.h:114
const char * BgBrightWhite
亮白色背景
Definition colorful.h:110
const char * Green
绿色前景
Definition colorful.h:48
const char * BgRed
红色背景
Definition colorful.h:82
const char * Red
红色前景
Definition colorful.h:46
const char * BrightRed
亮红色前景
Definition colorful.h:62
const char * Magenta
品红前景
Definition colorful.h:54
const char * BgBrightBlack
亮黑色背景
Definition colorful.h:96
const char * BgBrightCyan
亮青色背景
Definition colorful.h:108
const char * BgBrightGreen
亮绿色背景
Definition colorful.h:100
const char * BgBrightBlue
亮蓝色背景
Definition colorful.h:104
const char * BrightBlack
亮黑色(灰)前景
Definition colorful.h:60
const char * BgGreen
绿色背景
Definition colorful.h:84
const char * BgBlue
蓝色背景
Definition colorful.h:88
const char * White
白色前景
Definition colorful.h:58
const char * BrightBlue
亮蓝色前景
Definition colorful.h:68
const char * Reverse
反转(交换前景和背景)
Definition colorful.h:124
const char * BrightYellow
亮黄色前景
Definition colorful.h:66
const char * BgYellow
黄色背景
Definition colorful.h:86
const char * Yellow
黄色前景
Definition colorful.h:50
const char * BgBrightMagenta
亮品红背景
Definition colorful.h:106
const char * BgBrightRed
亮红色背景
Definition colorful.h:98
const char * Strikethrough
删除线
Definition colorful.h:128
const char * Black
黑色前景
Definition colorful.h:44
const char * BrightGreen
亮绿色前景
Definition colorful.h:64
const char * Cyan
青色前景
Definition colorful.h:56
const char * BgBlack
黑色背景
Definition colorful.h:80
const char * BrightCyan
亮青色前景
Definition colorful.h:72
const char * BrightMagenta
亮品红前景
Definition colorful.h:70
const char * Dim
暗淡(降低亮度)
Definition colorful.h:116
const char * BrightWhite
亮白色前景
Definition colorful.h:74
const char * BgWhite
白色背景
Definition colorful.h:94
const char * Hidden
隐藏(不可见)
Definition colorful.h:126
const char * Italic
斜体
Definition colorful.h:118
const char * BgMagenta
品红背景
Definition colorful.h:90
const char * Reset
重置所有颜色/样式
Definition colorful.h:76
const char * Blue
蓝色前景
Definition colorful.h:52
const char * Underline
下划线
Definition colorful.h:120
本库所有组件所在的顶层命名空间。