Stylistic Refactors
This commit is contained in:
@@ -7,12 +7,13 @@
|
||||
#include <cstdint>
|
||||
#include <format>
|
||||
#include <vector>
|
||||
#include "Color4.hpp"
|
||||
|
||||
// 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
|
||||
namespace mcolor
|
||||
{
|
||||
enum class Colors : uint8_t
|
||||
enum class AnsiColor : uint8_t
|
||||
{
|
||||
RESET = 0,
|
||||
BOLD,
|
||||
@@ -54,41 +55,34 @@ namespace mcolor::ansiColors
|
||||
};
|
||||
}
|
||||
|
||||
struct rgbColor
|
||||
{
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
};
|
||||
|
||||
namespace mcolor::rgbColors
|
||||
{
|
||||
// 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 Color4 BLACK = {0,0,0};
|
||||
static const Color4 RED = {170, 0, 0};
|
||||
static const Color4 GREEN = {0, 170, 0};
|
||||
static const Color4 YELLOW = {170, 170, 0};
|
||||
static const Color4 BLUE = {0, 0, 170};
|
||||
static const Color4 MAGENTA = {170, 0, 170};
|
||||
static const Color4 CYAN = {0, 170, 170};
|
||||
static const Color4 WHITE = {170, 170, 170};
|
||||
static const Color4 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};
|
||||
static const Color4 BRIGHT_BLACK = {8,5, 85,};
|
||||
static const Color4 BRIGHT_RED = {85, 85, 255};
|
||||
static const Color4 BRIGHT_GREEN = {85, 255, 85};
|
||||
static const Color4 BRIGHT_YELLOW = {85, 255, 255};
|
||||
static const Color4 BRIGHT_BLUE = {255, 85, 85};
|
||||
static const Color4 BRIGHT_MAGENTA = {255, 85, 255};
|
||||
static const Color4 BRIGHT_CYAN = {255, 255, 85};
|
||||
static const Color4 BRIGHT_WHITE = {255, 255, 255};
|
||||
}
|
||||
|
||||
namespace mcolor
|
||||
{
|
||||
std::string toEscapeCode(rgbColor c, bool bg=false);
|
||||
std::string toEscapeCode(Color4 c, bool bg=false);
|
||||
|
||||
std::string toEscapeCode(ansiColors::Colors c);
|
||||
std::string toEscapeCode(AnsiColor c);
|
||||
|
||||
#ifdef WIN32
|
||||
void windowsSaneify();
|
||||
@@ -98,15 +92,15 @@ namespace mcolor
|
||||
|
||||
std::vector<uint8_t> createRGBScale(uint8_t startValue = 200, uint8_t increment = 5);
|
||||
|
||||
std::vector<rgbColor> redScaler(rgbColor c);
|
||||
std::vector<Color4> redScaler(Color4 c);
|
||||
|
||||
std::vector<rgbColor> greenScaler(rgbColor c);
|
||||
std::vector<Color4> greenScaler(Color4 c);
|
||||
|
||||
std::vector<rgbColor> blueScaler(rgbColor c);
|
||||
std::vector<Color4> blueScaler(Color4 c);
|
||||
|
||||
std::vector<rgbColor> RGBColorScale(rgbColor startingColor, std::vector<rgbColor> (*scaler)(rgbColor));
|
||||
std::vector<Color4> RGBColorScale(Color4 startingColor, std::vector<Color4> (*scaler)(Color4));
|
||||
|
||||
void printRGBScale(std::vector<rgbColor> cs);
|
||||
void printRGBScale(std::vector<Color4> cs);
|
||||
|
||||
void printRGBConsoleTest();
|
||||
}
|
||||
|
Reference in New Issue
Block a user