35 static const XYZ white(95.047, 100.000, 108.883);
53 RGB(uint8_t red, uint8_t green, uint8_t blue)
60 RGB(
const uint32_t color) { _color.color = color; }
69static const RGB RED(255, 0, 0);
70static const RGB GREEN(0, 255, 0);
71static const RGB BLUE(0, 0, 255);
72static const RGB WHITE(255, 255, 255);
74static const RGB BLACK(0, 0, 0);
75static const RGB FUSHIA(255, 0, 255);
76static const RGB TEAL(0, 255, 255);
77static const RGB YELLOW(200, 255, 0);
78static const RGB PINK(255, 20, 147);
79static const RGB TOMATO(255, 99, 71);
80static const RGB ORANGE(255, 140, 0);
81static const RGB DARK_ORANGE(255, 90, 0);
82static const RGB PURPLE(128, 0, 128);
98 uint16_t
get_scaled_hue()
const {
return static_cast<uint16_t
>(
h / 360.0 * UINT16_MAX); }
111 LAB(
const double l,
const double a,
const double b) :
l(
l),
a(
a),
b(
b) {};
129 LCH(
const double l,
const double c,
const double h) :
l(
l),
c(
c),
h(
h) {};
137 uint16_t
get_scaled_hue()
const {
return static_cast<uint16_t
>(
h / 360.0 * UINT16_MAX); }
178 uint16_t
get_scaled_hue()
const {
return static_cast<uint16_t
>(
h / 360.0 * UINT16_MAX); }
Definition: colorspace.h:17
virtual ~Base()=default
virtual destructor
virtual COLOR get_rgb() const =0
return the rgb of this color
Definition: colorspace.h:85
double v
value
Definition: colorspace.h:102
void from_rgb(const COLOR &rgb)
construct from an RGB representation
Definition: colorspace.cpp:91
double s
Saturation.
Definition: colorspace.h:101
HSV(double h, double s, double v)
Construct from values.
Definition: colorspace.h:90
uint16_t get_scaled_hue() const
get the hue scaled between 0 and UINT16_MAX
Definition: colorspace.h:98
COLOR get_rgb() const override
get the rgb form (for display)
Definition: colorspace.cpp:47
HSV(const COLOR &c)
Construct from RGB.
Definition: colorspace.h:88
double h
Hue.
Definition: colorspace.h:100
Definition: colorspace.h:106
LAB(const COLOR &c)
Construct from RGB.
Definition: colorspace.h:109
double a
Alpha.
Definition: colorspace.h:119
double b
Brightness.
Definition: colorspace.h:120
double l
Luminance.
Definition: colorspace.h:118
void from_rgb(const COLOR &rgb)
construct from an RGB representation
Definition: colorspace.cpp:149
LAB(const double l, const double a, const double b)
Construct from values.
Definition: colorspace.h:111
COLOR get_rgb() const override
get the rgb form (for display)
Definition: colorspace.cpp:129
Definition: colorspace.h:124
void from_rgb(const COLOR &rgb)
construct from an RGB representation
Definition: colorspace.cpp:176
COLOR get_rgb() const override
get the rgb form (for display)
Definition: colorspace.cpp:168
uint16_t get_scaled_hue() const
get the hue scaled between 0 and UINT16_MAX
Definition: colorspace.h:137
LCH(const COLOR &c)
Construct from RGB.
Definition: colorspace.h:127
LCH(const double l, const double c, const double h)
Construct from values.
Definition: colorspace.h:129
double h
Hue 0 - 360.
Definition: colorspace.h:141
double l
Luminance.
Definition: colorspace.h:139
double c
Chroma.
Definition: colorspace.h:140
Definition: colorspace.h:145
void from_rgb(const COLOR &rgb)
construct from an RGB representation
Definition: colorspace.cpp:221
double a
Alpha.
Definition: colorspace.h:159
double l
Luminance.
Definition: colorspace.h:158
OKLAB(const COLOR &c)
Construct from RGB.
Definition: colorspace.h:148
double b
Brightness.
Definition: colorspace.h:160
OKLAB(const double l, const double a, const double b)
Construct from values.
Definition: colorspace.h:150
COLOR get_rgb() const override
get the rgb form (for display)
Definition: colorspace.cpp:200
Definition: colorspace.h:164
double l
Luminance.
Definition: colorspace.h:180
COLOR get_rgb() const override
get the rgb form (for display)
Definition: colorspace.cpp:244
OKLCH(const COLOR &c)
Construct from RGB.
Definition: colorspace.h:167
double h
Hue 0 - 360.
Definition: colorspace.h:182
void from_rgb(const COLOR &rgb)
construct from an RGB representation
Definition: colorspace.cpp:252
uint16_t get_scaled_hue() const
get the hue scaled between 0 and UINT16_MAX
Definition: colorspace.h:178
OKLCH(const double l, const double c, const double h)
Construct from values.
Definition: colorspace.h:169
double c
Chroma.
Definition: colorspace.h:181
Definition: colorspace.h:50
COLOR get_rgb() const override
Get the RGB representation.
Definition: colorspace.h:62
RGB(uint8_t red, uint8_t green, uint8_t blue)
construct from values
Definition: colorspace.h:53
RGB(const uint32_t color)
construct from color
Definition: colorspace.h:60
Definition: colorspace.h:26
static XYZ get_white()
Return the white value.
Definition: colorspace.h:33
XYZ(double x, double y, double z)
Construct from values.
Definition: colorspace.h:31
double y
Color space Y.
Definition: colorspace.h:45
double x
Color space X.
Definition: colorspace.h:44
void from_rgb(const COLOR &rgb)
construct from an RGB representation
Definition: colorspace.cpp:32
COLOR get_rgb() const override
get the rgb form (for display)
Definition: colorspace.cpp:11
XYZ(const COLOR &c)
Construct from RGB.
Definition: colorspace.h:29
double z
Color space Z.
Definition: colorspace.h:46
Program scope.
Definition: control_fixed_modes.hpp:12
Use this to convert color to bytes.
Definition: utils.h:128