aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/util/color.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/util/color.h')
-rw-r--r--src/crepe/util/color.h79
1 files changed, 42 insertions, 37 deletions
diff --git a/src/crepe/util/color.h b/src/crepe/util/color.h
index 066c9d3..0b7c1e6 100644
--- a/src/crepe/util/color.h
+++ b/src/crepe/util/color.h
@@ -1,41 +1,46 @@
#pragma once
-namespace crepe::util::color {
-
-constexpr const char * RESET = "\e[0m";
-
-constexpr const char * FG_BLACK = "\e[30m";
-constexpr const char * FG_RED = "\e[31m";
-constexpr const char * FG_GREEN = "\e[32m";
-constexpr const char * FG_YELLOW = "\e[33m";
-constexpr const char * FG_BLUE = "\e[34m";
-constexpr const char * FG_MAGENTA = "\e[35m";
-constexpr const char * FG_CYAN = "\e[36m";
-constexpr const char * FG_WHITE = "\e[37m";
-constexpr const char * BG_BLACK = "\e[40m";
-constexpr const char * BG_RED = "\e[41m";
-constexpr const char * BG_GREEN = "\e[42m";
-constexpr const char * BG_YELLOW = "\e[43m";
-constexpr const char * BG_BLUE = "\e[44m";
-constexpr const char * BG_MAGENTA = "\e[45m";
-constexpr const char * BG_CYAN = "\e[46m";
-constexpr const char * BG_WHITE = "\e[47m";
-
-constexpr const char * FG_BLACK_BRIGHT = "\e[90m";
-constexpr const char * FG_RED_BRIGHT = "\e[91m";
-constexpr const char * FG_GREEN_BRIGHT = "\e[92m";
-constexpr const char * FG_YELLOW_BRIGHT = "\e[93m";
-constexpr const char * FG_BLUE_BRIGHT = "\e[94m";
-constexpr const char * FG_MAGENTA_BRIGHT = "\e[95m";
-constexpr const char * FG_CYAN_BRIGHT = "\e[96m";
-constexpr const char * FG_WHITE_BRIGHT = "\e[97m";
-constexpr const char * BG_BLACK_BRIGHT = "\e[100m";
-constexpr const char * BG_RED_BRIGHT = "\e[101m";
-constexpr const char * BG_GREEN_BRIGHT = "\e[102m";
-constexpr const char * BG_YELLOW_BRIGHT = "\e[103m";
-constexpr const char * BG_BLUE_BRIGHT = "\e[104m";
-constexpr const char * BG_MAGENTA_BRIGHT = "\e[105m";
-constexpr const char * BG_CYAN_BRIGHT = "\e[106m";
-constexpr const char * BG_WHITE_BRIGHT = "\e[107m";
+#include <string>
+
+namespace crepe::util {
+
+class LogColor {
+public:
+ LogColor() = default;
+
+public:
+ const char * c_str(const char * content = NULL);
+ const std::string str(const std::string & content = "");
+
+public:
+ LogColor & reset();
+
+public:
+ LogColor & fg_black(bool bright = false);
+ LogColor & fg_red(bool bright = false);
+ LogColor & fg_green(bool bright = false);
+ LogColor & fg_yellow(bool bright = false);
+ LogColor & fg_blue(bool bright = false);
+ LogColor & fg_magenta(bool bright = false);
+ LogColor & fg_cyan(bool bright = false);
+ LogColor & fg_white(bool bright = false);
+
+public:
+ LogColor & bg_black(bool bright = false);
+ LogColor & bg_red(bool bright = false);
+ LogColor & bg_green(bool bright = false);
+ LogColor & bg_yellow(bool bright = false);
+ LogColor & bg_blue(bool bright = false);
+ LogColor & bg_magenta(bool bright = false);
+ LogColor & bg_cyan(bool bright = false);
+ LogColor & bg_white(bool bright = false);
+
+private:
+ LogColor & add_code(unsigned int code);
+
+private:
+ std::string code = "";
+ std::string final = "";
+};
} // namespace crepe::util::color