Ejemplo 1: c ++ imprimir colorido
//the following are UBUNTU/LINUX, and MacOS ONLY terminal color codes.
#define RESET " 33[0m"
#define BLACK " 33[30m" /* Black */
#define RED " 33[31m" /* Red */
#define GREEN " 33[32m" /* Green */
#define YELLOW " 33[33m" /* Yellow */
#define BLUE " 33[34m" /* Blue */
#define MAGENTA " 33[35m" /* Magenta */
#define CYAN " 33[36m" /* Cyan */
#define WHITE " 33[37m" /* White */
#define BOLDBLACK " 33[1m 33[30m" /* Bold Black */
#define BOLDRED " 33[1m 33[31m" /* Bold Red */
#define BOLDGREEN " 33[1m 33[32m" /* Bold Green */
#define BOLDYELLOW " 33[1m 33[33m" /* Bold Yellow */
#define BOLDBLUE " 33[1m 33[34m" /* Bold Blue */
#define BOLDMAGENTA " 33[1m 33[35m" /* Bold Magenta */
#define BOLDCYAN " 33[1m 33[36m" /* Bold Cyan */
#define BOLDWHITE " 33[1m 33[37m" /* Bold White */
Ejemplo 2: color cout
#define RESET " 33[0m"
#define BLACK " 33[30m" /* Black */
#define RED " 33[31m" /* Red */
#define GREEN " 33[32m" /* Green */
#define YELLOW " 33[33m" /* Yellow */
#define BLUE " 33[34m" /* Blue */
#define MAGENTA " 33[35m" /* Magenta */
#define CYAN " 33[36m" /* Cyan */
#define WHITE " 33[37m" /* White */
#define BOLDBLACK " 33[1m 33[30m" /* Bold Black */
Ejemplo 3: consola de c ++ colorea algunos dígitos
cout
Ejemplo 4: consola de c ++ colorea algunos dígitos
#include
namespace Color {
enum Code {
FG_RED = 31,
FG_GREEN = 32,
FG_BLUE = 34,
FG_DEFAULT = 39,
BG_RED = 41,
BG_GREEN = 42,
BG_BLUE = 44,
BG_DEFAULT = 49
};
class Modifier {
Code code;
public:
Modifier(Code pCode) : code(pCode) {}
friend std::ostream&
operator
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)