Record基本完成。
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
#include "Tools.hpp"
|
||||
setoutputcolor::setoutputcolor() : color(clear), bold(false) {};
|
||||
|
||||
setoutputcolor::setoutputcolor(ConsoleColors _color) : color(_color), bold(false) {};
|
||||
setoutputcolor::setoutputcolor(ConsoleColors _color)
|
||||
: color(_color), bold(false){};
|
||||
|
||||
setoutputcolor::setoutputcolor(bool _bold) : color(clear), bold(_bold) {};
|
||||
setoutputcolor::setoutputcolor(bool _bold) : color(clear), bold(_bold){};
|
||||
|
||||
setoutputcolor::setoutputcolor(ConsoleColors _color, bool _bold) : color(_color), bold(_bold) {};
|
||||
setoutputcolor::setoutputcolor(ConsoleColors _color, bool _bold)
|
||||
: color(_color), bold(_bold){};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, setoutputcolor setOutput) {
|
||||
out << "\033[";
|
||||
@@ -20,6 +21,9 @@ std::ostream &operator<<(std::ostream &out, setoutputcolor setOutput) {
|
||||
out << "0";
|
||||
}
|
||||
switch (setOutput.color) {
|
||||
case black:
|
||||
out << ";30m";
|
||||
break;
|
||||
case red:
|
||||
out << ";31m";
|
||||
break;
|
||||
@@ -29,14 +33,55 @@ std::ostream &operator<<(std::ostream &out, setoutputcolor setOutput) {
|
||||
case blue:
|
||||
out << ";34m";
|
||||
break;
|
||||
default:
|
||||
out << ";0m";
|
||||
case magenta:
|
||||
out << ";35m";
|
||||
break;
|
||||
case cyan:
|
||||
out << ";36m";
|
||||
break;
|
||||
case lightGray:
|
||||
out << ";37m";
|
||||
break;
|
||||
default:
|
||||
out << "m\033[0m";
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, setbgcolor setbg) {
|
||||
switch (setbg.color) {
|
||||
case black:
|
||||
out << "\033[7;30m";
|
||||
break;
|
||||
case red:
|
||||
out << "\033[7;31m";
|
||||
break;
|
||||
case green:
|
||||
out << "\033[7;32m";
|
||||
break;
|
||||
case blue:
|
||||
out << "\033[7;34m";
|
||||
break;
|
||||
case magenta:
|
||||
out << "\033[7;35m";
|
||||
break;
|
||||
case cyan:
|
||||
out << "\033[7;36m";
|
||||
break;
|
||||
case lightGray:
|
||||
out << "\033[7;37m";
|
||||
break;
|
||||
default:
|
||||
// clang-format off
|
||||
{;}
|
||||
// clang-format on
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
setbgcolor::setbgcolor(ConsoleColors _color) : color(_color){};
|
||||
|
||||
std::ostream &resetOutputColor(std::ostream &out) {
|
||||
out << setoutputcolor();
|
||||
out << setoutputcolor(clear);
|
||||
return out;
|
||||
}
|
||||
Reference in New Issue
Block a user