Swap LightGray and DarkGray.

This commit is contained in:
2025-02-26 15:05:14 -05:00
parent 69177ff958
commit 9602b24dd1
4 changed files with 90 additions and 77 deletions

View File

@@ -10,84 +10,10 @@
#include <iostream>
#include <stdexcept>
#include <vector>
#include "ColorFormats.hpp"
using u8 = uint8_t;
/// A structure representing color in Red, Green, Blue format, 8 bits-per-color, or 24-bit, or True-color.
struct RGB {
u8 r;
u8 g;
u8 b;
};
struct RGBA {
u8 r;
u8 g;
u8 b;
u8 a;
};
struct RGBf {
float r;
float g;
float b;
};
struct RGBAf {
float r;
float g;
float b;
float a;
};
/// A structure representing color in Hue, Chroma, Value format.
struct HSV {
float h;
float s;
float v;
};
struct HSVA {
float h;
float s;
float v;
float a;
};
struct HSL {
float h;
float s;
float l;
};
struct HSLA {
float h;
float s;
float l;
float a;
};
/// A structure representing a Lum, Chroma, Lightness value.
struct LCH {
float l;
float h;
float c;
};
struct LCHA {
float l;
float h;
float c;
float a;
};
struct CMYK {
float c;
float m;
float y;
float k;
};
class Color4;
std::string toEscapeCode(Color4 c, bool bg=false);
@@ -134,9 +60,11 @@ public:
/// Constructs a new Color4 from an HSVA structure.
explicit Color4(const HSVA& hsva);
/// Constructs a new
/// TODO: HSL to RGB constructor
explicit Color4(const HSL& hsl, float alpha = 1.f);
// TODO: LCH to RGB constructor
explicit Color4(const LCH& lch, float alpha = 1.f);
// TODO: LCHA to RGB constructor
explicit Color4(const LCHA& lcha);
@@ -197,7 +125,7 @@ public:
HSL ToHSL() const;
HSLA ToHSLA() const;
// TODO: Color4 ToLCH
LCH ToLCH() const;
};

78
include/ColorFormats.hpp Normal file
View File

@@ -0,0 +1,78 @@
#pragma once
using u8 = uint8_t;
/// A structure representing color in Red, Green, Blue format, 8 bits-per-color, or 24-bit, or True-color.
struct RGB {
u8 r;
u8 g;
u8 b;
};
struct RGBA {
u8 r;
u8 g;
u8 b;
u8 a;
};
struct RGBf {
float r;
float g;
float b;
};
struct RGBAf {
float r;
float g;
float b;
float a;
};
/// A structure representing color in Hue, Chroma, Value format.
struct HSV {
float h;
float s;
float v;
};
struct HSVA {
float h;
float s;
float v;
float a;
};
struct HSL {
float h;
float s;
float l;
};
struct HSLA {
float h;
float s;
float l;
float a;
};
/// A structure representing a Lum, Chroma, Lightness value.
struct LCH {
float l;
float h;
float c;
};
struct LCHA {
float l;
float h;
float c;
float a;
};
struct CMYK {
float c;
float m;
float y;
float k;
};