125 inv_rgb->
r = rgb->
r ^ 0xFF;
126 inv_rgb->
g = rgb->
g ^ 0xFF;
127 inv_rgb->
b = rgb->
b ^ 0xFF;
143 out->
r = rgb->
r << shift;
144 out->
g = rgb->
g << shift;
145 out->
b = rgb->
b << shift;
147 out->
r = rgb->
r >> -shift;
148 out->
g = rgb->
g >> -shift;
149 out->
b = rgb->
b >> -shift;
164 out->
r = ((unsigned)rgb->
r * level + 128) >> 8;
165 out->
g = ((unsigned)rgb->
g * level + 128) >> 8;
166 out->
b = ((unsigned)rgb->
b * level + 128) >> 8;
void color_str2rgb(const char *str, color_rgb_t *color)
Convert a hex color string of the form 'RRGGBB' to a color_rgb_t struct.
void color_hex2rgb(const uint32_t hex, color_rgb_t *rgb)
Convert a hex value of the form 0x00RRGGBB to an RGB color struct.
void color_rgb2hsv(color_rgb_t *rgb, color_hsv_t *hsv)
Convert RGB color to HSV color.
static void color_rgb_set_brightness(const color_rgb_t *rgb, color_rgb_t *out, uint8_t level)
Change the brightness of a RGB color by multiplying it with a set factor.
void color_rgb2str(const color_rgb_t *rgb, char *str)
Convert a color_rgb_t struct to a hex color string of the form 'RRGGBB'.
void color_hsv2rgb(color_hsv_t *hsv, color_rgb_t *rgb)
Convert HSV color to RGB color.
void color_rgb_complementary(const color_rgb_t *rgb, color_rgb_t *comp_rgb)
Calculate the complementary color of a given rgb color.
static void color_rgb_invert(const color_rgb_t *rgb, color_rgb_t *inv_rgb)
Invert a given rgb color.
void color_rgb2hex(const color_rgb_t *rgb, uint32_t *hex)
Convert a rgb struct to a hex value of the form 0x00RRGGBB.
static void color_rgb_shift(const color_rgb_t *rgb, color_rgb_t *out, int8_t shift)
Shifts a given rgb color to change it's brightness.
Data-structure for holding HSV colors.
float s
saturation value [0.0 - 1.0]
float h
hue value [0.0 - 360.0]
Data-structure describing a RGB color.
uint8_t b
blue value [0 - 255]
uint8_t r
red value [0 - 255]
uint8_t g
green value [0 - 255]
color_rgb_t color
RGB value.
uint8_t alpha
alpha value [0 - 255]