Did some cleanup
This commit is contained in:
130
include/mcolor.h
130
include/mcolor.h
@@ -4,20 +4,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdint>
|
||||
#include <format>
|
||||
|
||||
/*
|
||||
struct ansiColor
|
||||
{
|
||||
std::string code;
|
||||
};
|
||||
*/
|
||||
#include <vector>
|
||||
|
||||
// Gets set to whatever your terminal emulator is configured for.
|
||||
// This means black can be shown as purple if configured that way.
|
||||
|
||||
namespace mcolor::ansiColors
|
||||
{
|
||||
enum class Colors : uint8_t
|
||||
@@ -61,77 +53,6 @@ namespace mcolor::ansiColors
|
||||
BG_BRIGHT_WHITE = 107,
|
||||
};
|
||||
}
|
||||
/*
|
||||
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 Codes : 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
|
||||
{
|
||||
@@ -163,39 +84,6 @@ namespace mcolor::rgbColors
|
||||
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
|
||||
{
|
||||
std::string toEscapeCode(rgbColor c, bool bg=false);
|
||||
@@ -205,4 +93,20 @@ namespace mcolor
|
||||
#ifdef WIN32
|
||||
void windowsSaneify();
|
||||
#endif
|
||||
|
||||
void printAnsiColorTable();
|
||||
|
||||
std::vector<uint8_t> createRGBScale(uint8_t startValue = 200, uint8_t increment = 5);
|
||||
|
||||
std::vector<rgbColor> redScaler(rgbColor c);
|
||||
|
||||
std::vector<rgbColor> greenScaler(rgbColor c);
|
||||
|
||||
std::vector<rgbColor> blueScaler(rgbColor c);
|
||||
|
||||
std::vector<rgbColor> RGBColorScale(rgbColor startingColor, std::vector<rgbColor> (*scaler)(rgbColor));
|
||||
|
||||
void printRGBScale(std::vector<rgbColor> cs);
|
||||
|
||||
void printRGBConsoleTest();
|
||||
}
|
||||
|
Reference in New Issue
Block a user