Commit "Colors"

This commit is contained in:
enqfila 2021-08-15 21:15:57 +00:00
parent 7a2bfae5ae
commit de76e1c938
2 changed files with 66 additions and 0 deletions

32
Objects/Utils/Colors.cpp Normal file
View File

@ -0,0 +1,32 @@
#include "Colors.h"
Colors::Colors(){
this->returnDefault();
}
void Colors::returnDefault(){
this->unkn = red;
this->unknMark = magenta;
this->kn = green;
this->knMark = cyan;
this->occup = yellow;
this->occupMark = blue;
this->reset = resetColor;
this->invert = invertText;
this->cross = crossText;
}
void Colors::changeColor(int index, std::string color){
switch(index){
case 0: this->reset = color; break;
case 1: this->unkn = color; break;
case 2: this->unknMark = color; break;
case 3: this->kn = color; break;
case 4: this->knMark = color; break;
case 5: this->occup = color; break;
case 6: this->occupMark = color; break;
case 7: this->invert = color; break;
case 8: this->cross = color; break;
default: break;
}
}

34
Objects/Utils/Colors.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef COLORS_H
#define COLORS_H
#include <string>
static const std::string red ("\033[0;31;1m");
static const std::string green ("\033[0;32;1m");
static const std::string yellow ("\033[0;33;1m");
static const std::string blue ("\033[0;34;1m");
static const std::string magenta ("\033[0;35;1m");
static const std::string cyan ("\033[0;36;1m");
static const std::string white ("\033[0;37;1m");
static const std::string resetColor ("\033[0m");
static const std::string invertText("\033[7m");
static const std::string crossText ("\033[9m");
class Colors{
public:
Colors();
std::string unkn;
std::string unknMark;
std::string kn;
std::string knMark;
std::string occup;
std::string occupMark;
std::string reset;
std::string invert;
std::string cross;
void returnDefault();
void changeColor(int index, std::string color);
};
#endif