Go to the documentation of this file.
20 rgbColor(
float rr,
float gg,
float bb) :
r(rr),
g(gg),
b(bb) {}
27 return rgbColor((1-perc)*c1.
r+c2.
r*perc, (1-perc)*c1.
g+c2.
g*perc, (1-perc)*c1.
b+c2.
b*perc);
38 float q = l < 0.5f ? l * (1 + s) : l + s - l * s;
48 r = (1-perc)*
r+c.
r*perc;
49 g = (1-perc)*
g+c.
g*perc;
50 b = (1-perc)*
b+c.
b*perc;
52 std::string
hex()
const
54 sprintf(tmp,
"#%X%X%X%X%X%X",
55 (
int(
r*255))/16, (
int(
r*255))%16,
56 (
int(
g*255))/16, (
int(
g*255))%16,
57 (
int(
b*255))/16, (
int(
b*255))%16);
60 void hex(
const char *str)
64 printf(
"Conversion failed\n");
73 static float hue2rgb(
float p,
float q,
float t)
77 if (t < 1.0/6.0)
return p + (q - p) * 6 * t;
78 if (t < 1.0/2.0)
return q;
79 if (t < 2.0/3.0)
return p + (q - p) * (2.0/3.0 - t) * 6;
rgbColor operator+(const rgbColor &c) const
rgbColor GetColor(float v, float vmin, float vmax, int type)
Given min/max values, get a color from a color schema.
static rgbColor hsl(float h, float s, float l)
const rgbColor lightyellow
A color; r/g/b are between 0...1.
void mix(const rgbColor &c, float perc)
rgbColor & operator=(const rgbColor &)=default
const rgbColor darkbluegray
const rgbColor darkpurple
bool operator!=(const rgbColor &r1, const rgbColor &r2)
void hex(const char *str)
const rgbColor lightbluegray
const rgbColor lightbrown
rgbColor(float rr, float gg, float bb)
const rgbColor darkyellow
rgbColor operator*(float p) const
rgbColor & operator*=(float p)
const rgbColor lighterblue
const rgbColor lightgreen
static float hue2rgb(float p, float q, float t)
const rgbColor lighterred
bool operator==(const rgbColor &r1, const rgbColor &r2)
static rgbColor mix(const rgbColor &c1, const rgbColor &c2, float perc)