32 sR = (uint8_t)
R * (uint8_t)maxBrightness / 255;
33 sG = (uint8_t)
G * (uint8_t)maxBrightness / 255;
34 sB = (uint8_t)
B * (uint8_t)maxBrightness / 255;
36 sR = sR > 255 ? 255 : sR;
37 sG = sG > 255 ? 255 : sG;
38 sB = sB > 255 ? 255 : sB;
50 sR = (uint8_t)
R + (uint8_t)value;
51 sG = (uint8_t)
G + (uint8_t)value;
52 sB = (uint8_t)
B + (uint8_t)value;
54 sR = sR > 255 ? 255 : sR;
55 sG = sG > 255 ? 255 : sG;
56 sB = sB > 255 ? 255 : sB;
69 float hueRat = 0.5f * sinf(hueRad / 2.0f);
82 c.
R = a.
R * (1.0f - ratio) + b.
R * ratio;
83 c.
G = a.
G * (1.0f - ratio) + b.
G * ratio;
84 c.
B = a.
B * (1.0f - ratio) + b.
B * ratio;
90 String r = String(this->
R);
91 String g = String(this->
G);
92 String b = String(this->
B);
94 return "[" + r +
", " + g +
", " + b +
"]";
Defines the RGBColor class for managing and manipulating RGB color values.
static const float MPI
Mathematical constant (3.14159265358979323846...).
A mathematical construct representing a rotation in 3D space.
Vector2D RotateVector(const Vector2D &v) const
Rotates a 2D vector by this quaternion, projecting it in 2D.
String ToString()
Converts the RGBColor to a string representation.
uint16_t color
Encoded 16-bit RGB565 color value.
RGBColor()
Default constructor initializes the color to black (0, 0, 0).
RGBColor HueShift(const float &hueDeg)
Shifts the hue of the color by a specified angle in degrees.
void SetColor(const uint8_t &R, const uint8_t &G, const uint8_t &B)
Sets the RGB values of the color.
RGBColor Scale(const uint8_t &maxBrightness)
Scales the brightness of the color to a maximum value.
static RGBColor InterpolateColors(const RGBColor &a, const RGBColor &b, const float &ratio)
Interpolates between two colors based on a ratio.
uint8_t B
Blue component of the color (0-255).
uint8_t G
Green component of the color (0-255).
RGBColor Add(const uint8_t &value)
Adds a value to each RGB component of the color.
uint8_t R
Red component of the color (0-255).
Vector2D Constrain(const float &minimum, const float &maximum) const
Constrains each component of this vector between the specified minimum and maximum.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
float Z
The Z-component of the 3D vector.
float X
The X-component of the 3D vector.
float Y
The Y-component of the 3D vector.