1
Fork 0
This repository has been archived on 2025-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
puzzle-wuzzle-generator/lib/colored_output.cpp
2014-02-18 16:12:04 +01:00

29 lines
741 B
C++

#include "colored_output.hpp"
static const bool disable_colors = false;
static const std::string reset = "\x1b[49;39m";
static const std::string colors[12] = {
"\x1B[33;43m", //yellow
"\x1B[91;101m", //bright red
"\x1B[94;104m", //bright blue
"\x1B[92;102m", //bright green
"\x1B[95;105m", //bright magenta
"\x1B[96;106m", //bright cyan
"\x1B[93;103m", //bright yellow
"\x1B[31;41m", //red
"\x1B[34;44m", //blue
"\x1B[32;42m", //green
"\x1B[35;45m", //magenta
"\x1B[36;46m" //cyan
};
std::string colored_block(int color){
if(disable_colors){
if(color == 0) return " ";
else return std::to_string(color);
} else {
if(color == 0) return " ";
else return colors[color % 12] + std::to_string(color) + " " + reset;
}
}