Redid some shit. Still figuring out structure
This commit is contained in:
249
include/mcolor.h
249
include/mcolor.h
@@ -7,89 +7,202 @@
|
||||
#include <iostream>
|
||||
#include <cstdint>
|
||||
|
||||
/*
|
||||
struct ansiColor
|
||||
{
|
||||
std::string code;
|
||||
};
|
||||
*/
|
||||
|
||||
// Gets set to whatever your terminal emulator is configured for.
|
||||
// This means black can be shown as purple if configured that way.
|
||||
namespace mcolor::ansiColorCodes
|
||||
|
||||
namespace mcolor::ansiColors
|
||||
{
|
||||
struct ansiColor
|
||||
enum class FG_Colors : uint8_t
|
||||
{
|
||||
std::string code;
|
||||
BLACK = 30,
|
||||
RED,
|
||||
GREEN,
|
||||
YELLOW,
|
||||
BLUE,
|
||||
MAGENTA,
|
||||
CYAN,
|
||||
WHITE,
|
||||
DEFAULT = 39,
|
||||
};
|
||||
|
||||
inline static const std::string FG_BLACK = "\033[30m";
|
||||
inline static const std::string FG_RED = "\033[31m";
|
||||
inline static const std::string FG_GREEN = "\033[32m";
|
||||
inline static const std::string FG_YELLOW = "\033[33m";
|
||||
inline static const std::string FG_BLUE = "\033[34m";
|
||||
inline static const std::string FG_MAGENTA = "\033[35m";
|
||||
inline static const std::string FG_CYAN = "\033[36m";
|
||||
inline static const std::string FG_WHITE = "\033[37m";
|
||||
inline static const std::string FG_DEFAULT = "\033[39m";
|
||||
enum class BG_Colors : uint8_t
|
||||
{
|
||||
BLACK = 40,
|
||||
RED,
|
||||
GREEN,
|
||||
YELLOW,
|
||||
BLUE,
|
||||
MAGENTA,
|
||||
CYAN,
|
||||
WHITE,
|
||||
DEFAULT = 49,
|
||||
};
|
||||
|
||||
enum class FG_Bright_Colors : uint8_t
|
||||
{
|
||||
BLACK = 90,
|
||||
RED,
|
||||
GREEN,
|
||||
YELLOW,
|
||||
BLUE,
|
||||
MAGENTA,
|
||||
CYAN,
|
||||
WHITE,
|
||||
};
|
||||
|
||||
inline static const std::string FG_BRIGHT_BLACK = "\033[90m";
|
||||
inline static const std::string FG_BRIGHT_RED = "\033[91m";
|
||||
inline static const std::string FG_BRIGHT_GREEN = "\033[92m";
|
||||
inline static const std::string FG_BRIGHT_YELLOW = "\033[93m";
|
||||
inline static const std::string FG_BRIGHT_BLUE = "\033[94m";
|
||||
inline static const std::string FG_BRIGHT_MAGENTA = "\033[95m";
|
||||
inline static const std::string FG_BRIGHT_CYAN = "\033[96m";
|
||||
inline static const std::string FG_BRIGHT_WHITE = "\033[97m";
|
||||
|
||||
|
||||
inline static const std::string BG_BLACK = "\033[40m";
|
||||
inline static const std::string BG_RED = "\033[41m";
|
||||
inline static const std::string BG_GREEN = "\033[42m";
|
||||
inline static const std::string BG_YELLOW = "\033[43m";
|
||||
inline static const std::string BG_BLUE = "\033[44m";
|
||||
inline static const std::string BG_MAGENTA = "\033[45m";
|
||||
inline static const std::string BG_CYAN = "\033[46m";
|
||||
inline static const std::string BG_WHITE = "\033[47m";
|
||||
inline static const std::string BG_DEFAULT = "\033[49m";
|
||||
|
||||
inline static const std::string BG_BRIGHT_BLACK = "\033[100m";
|
||||
inline static const std::string BG_BRIGHT_RED = "\033[101m";
|
||||
inline static const std::string BG_BRIGHT_GREEN = "\033[102m";
|
||||
inline static const std::string BG_BRIGHT_YELLOW = "\033[103m";
|
||||
inline static const std::string BG_BRIGHT_BLUE = "\033[104m";
|
||||
inline static const std::string BG_BRIGHT_MAGENTA = "\033[105m";
|
||||
inline static const std::string BG_BRIGHT_CYAN = "\033[106m";
|
||||
inline static const std::string BG_BRIGHT_WHITE = "\033[107m";
|
||||
|
||||
inline static const std::string RESET = "\033[0m";
|
||||
inline static const std::string BOLD = "\033[1m";
|
||||
inline static const std::string DIM = "\033[2m";
|
||||
enum class BG_Bright_Colors : uint8_t
|
||||
{
|
||||
BLACK = 100,
|
||||
RED,
|
||||
GREEN,
|
||||
YELLOW,
|
||||
BLUE,
|
||||
MAGENTA,
|
||||
CYAN,
|
||||
WHITE,
|
||||
};
|
||||
}
|
||||
/*
|
||||
namespace mcolor::ansiColorCodes
|
||||
{
|
||||
|
||||
inline static const ansiColor FG_BLACK = {{"\033[30m"}};
|
||||
inline static const ansiColor FG_RED = {"\033[31m"};
|
||||
inline static const ansiColor FG_GREEN = {"\033[32m"};
|
||||
inline static const ansiColor FG_YELLOW = {"\033[33m"};
|
||||
inline static const ansiColor FG_BLUE = {"\033[34m"};
|
||||
inline static const ansiColor FG_MAGENTA = {"\033[35m"};
|
||||
inline static const ansiColor FG_CYAN = {"\033[36m"};
|
||||
inline static const ansiColor FG_WHITE = {"\033[37m"};
|
||||
inline static const ansiColor FG_DEFAULT = {"\033[39m"};
|
||||
|
||||
|
||||
inline static const ansiColor FG_BRIGHT_BLACK = {"\033[90m"};
|
||||
inline static const ansiColor FG_BRIGHT_RED = {"\033[91m"};
|
||||
inline static const ansiColor FG_BRIGHT_GREEN = {"\033[92m"};
|
||||
inline static const ansiColor FG_BRIGHT_YELLOW = {"\033[93m"};
|
||||
inline static const ansiColor FG_BRIGHT_BLUE = {"\033[94m"};
|
||||
inline static const ansiColor FG_BRIGHT_MAGENTA = {"\033[95m"};
|
||||
inline static const ansiColor FG_BRIGHT_CYAN = {"\033[96m"};
|
||||
inline static const ansiColor FG_BRIGHT_WHITE = {"\033[97m"};
|
||||
|
||||
|
||||
inline static const ansiColor BG_BLACK = {"\033[40m"};
|
||||
inline static const ansiColor BG_RED = {"\033[41m"};
|
||||
inline static const ansiColor BG_GREEN = {"\033[42m"};
|
||||
inline static const ansiColor BG_YELLOW = {"\033[43m"};
|
||||
inline static const ansiColor BG_BLUE = {"\033[44m"};
|
||||
inline static const ansiColor BG_MAGENTA = {"\033[45m"};
|
||||
inline static const ansiColor BG_CYAN = {"\033[46m"};
|
||||
inline static const ansiColor BG_WHITE = {"\033[47m"};
|
||||
inline static const ansiColor BG_DEFAULT = {"\033[49m"};
|
||||
|
||||
inline static const ansiColor BG_BRIGHT_BLACK = {"\033[100m"};
|
||||
inline static const ansiColor BG_BRIGHT_RED = {"\033[101m"};
|
||||
inline static const ansiColor BG_BRIGHT_GREEN = {"\033[102m"};
|
||||
inline static const ansiColor BG_BRIGHT_YELLOW = {"\033[103m"};
|
||||
inline static const ansiColor BG_BRIGHT_BLUE = {"\033[104m"};
|
||||
inline static const ansiColor BG_BRIGHT_MAGENTA = {"\033[105m"};
|
||||
inline static const ansiColor BG_BRIGHT_CYAN = {"\033[106m"};
|
||||
inline static const ansiColor BG_BRIGHT_WHITE = {"\033[107m"};
|
||||
}
|
||||
*/
|
||||
|
||||
namespace mcolor::ansiControlCodes
|
||||
{
|
||||
enum class Text_Manip : uint8_t
|
||||
{
|
||||
RESET,
|
||||
BOLD,
|
||||
DIM,
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
struct ansiControl
|
||||
{
|
||||
std::string code;
|
||||
};
|
||||
|
||||
namespace mcolor::ansiControlCodes
|
||||
{
|
||||
inline static const ansiControl RESET = {"\033[0m"};
|
||||
inline static const ansiControl BOLD = {"\033[1m"};
|
||||
inline static const ansiControl DIM = {"\033[2m"};
|
||||
}
|
||||
*/
|
||||
|
||||
struct rgbColor
|
||||
{
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
};
|
||||
|
||||
namespace mcolor::rgbColors
|
||||
{
|
||||
struct rgbColor
|
||||
{
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
};
|
||||
|
||||
// Basically default ugly standard UNIX colors for now
|
||||
static const rgbColor BLACK {0,0,0};
|
||||
static const rgbColor RED {170, 0, 0};
|
||||
static const rgbColor GREEN {0, 170, 0};
|
||||
static const rgbColor YELLOW {170, 170, 0};
|
||||
static const rgbColor BLUE {0, 0, 170};
|
||||
static const rgbColor MAGENTA {170, 0, 170};
|
||||
static const rgbColor CYAN {0, 170, 170};
|
||||
static const rgbColor WHITE {170, 170, 170};
|
||||
static const rgbColor DEFAULT {170, 170, 170};
|
||||
static const rgbColor BLACK = {0,0,0};
|
||||
static const rgbColor RED = {170, 0, 0};
|
||||
static const rgbColor GREEN = {0, 170, 0};
|
||||
static const rgbColor YELLOW = {170, 170, 0};
|
||||
static const rgbColor BLUE = {0, 0, 170};
|
||||
static const rgbColor MAGENTA = {170, 0, 170};
|
||||
static const rgbColor CYAN = {0, 170, 170};
|
||||
static const rgbColor WHITE = {170, 170, 170};
|
||||
static const rgbColor DEFAULT = {170, 170, 170};
|
||||
|
||||
static const rgbColor BRIGHT_BLACK = {8,5, 85,};
|
||||
static const rgbColor BRIGHT_RED = {85, 85, 255};
|
||||
static const rgbColor BRIGHT_GREEN = {85, 255, 85};
|
||||
static const rgbColor BRIGHT_YELLOW = {85, 255, 255};
|
||||
static const rgbColor BRIGHT_BLUE = {255, 85, 85};
|
||||
static const rgbColor BRIGHT_MAGENTA = {255, 85, 255};
|
||||
static const rgbColor BRIGHT_CYAN = {255, 255, 85};
|
||||
static const rgbColor BRIGHT_WHITE = {255, 255, 255};
|
||||
}
|
||||
|
||||
/*
|
||||
struct Color
|
||||
{
|
||||
uint8_t ansi;
|
||||
rgbColor rgb;
|
||||
bool bg = false;
|
||||
};
|
||||
*/
|
||||
|
||||
/*
|
||||
namespace mcolor::Colors
|
||||
{
|
||||
static const rgbColor BLACK = {0,0,0};
|
||||
static const rgbColor RED = {170, 0, 0};
|
||||
static const rgbColor GREEN = {0, 170, 0};
|
||||
static const rgbColor YELLOW = {170, 170, 0};
|
||||
static const rgbColor BLUE = {0, 0, 170};
|
||||
static const rgbColor MAGENTA = {170, 0, 170};
|
||||
static const rgbColor CYAN = {0, 170, 170};
|
||||
static const rgbColor WHITE = {170, 170, 170};
|
||||
static const rgbColor DEFAULT = {170, 170, 170};
|
||||
|
||||
static const rgbColor BRIGHT_BLACK = {8,5, 85,};
|
||||
static const rgbColor BRIGHT_RED = {85, 85, 255};
|
||||
static const rgbColor BRIGHT_GREEN = {85, 255, 85};
|
||||
static const rgbColor BRIGHT_YELLOW = {85, 255, 255};
|
||||
static const rgbColor BRIGHT_BLUE = {255, 85, 85};
|
||||
static const rgbColor BRIGHT_MAGENTA = {255, 85, 255};
|
||||
static const rgbColor BRIGHT_CYAN = {255, 255, 85};
|
||||
static const rgbColor BRIGHT_WHITE = {255, 255, 255};
|
||||
}
|
||||
*/
|
||||
|
||||
namespace mcolor
|
||||
{
|
||||
struct Color
|
||||
{
|
||||
union
|
||||
{
|
||||
mcolor::ansiColorCodes::ansiColor ansi;
|
||||
mcolor::rgbColors::rgbColor rgb;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user