color.h¶
Headers for the color handling module.
-
void
color_rgb2hsv(color_rgb_t * rgb, color_hsv_t * hsv)¶ Convert RGB color to HSV color.
Parameters
rgb: Input color encoded in RGB space hsv: Output color encoded in HSV space
-
void
color_hsv2rgb(color_hsv_t * hsv, color_rgb_t * rgb)¶ Convert HSV color to RGB color.
Parameters
hsv: Input color encoded in HSV space rgb: Output color encoded in RGB space
-
void
color_hex2rgb(const uint32_t hex, color_rgb_t * rgb)¶ Convert a
hexvalue of the form 0x00RRGGBB to an RGB color struct.Note
the two most significant bytes of
hexwill be ignoredParameters
hex: Input color encoded in hex rgb: Output color encoded in RGB space
-
void
color_rgb2hex(const color_rgb_t * rgb, uint32_t * hex)¶ Convert a
rgbstruct to ahexvalue of the form 0x00RRGGBB.Note
the two most significant bytes of
hexwill be 0Parameters
rgb: Input color encoded in RGB space hex: Output color encoded in hex
-
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.
Note
strMUST contain only hexadecimal digits. Expect unexpected behaviour, otherwise.Parameters
str: Input color encoded as string of the form ‘RRGGBB’ color: Output color encoded in RGB space
-
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’.
Note
strMUST be big enough to hold 6 charactersParameters
rgb: Input color encoded in RGB space str: Output color encoded as string of the form ‘RRGGBB’
-
void
color_rgb_invert(const color_rgb_t * rgb, color_rgb_t * inv_rgb)¶ Invert a given rgb color.
Parameters
rgb: Input rgb color, that should be converted. Must be NOT NULL inv_rgb: Output rgb color, result of the conversion. Must be NOT NULL
-
void
color_rgb_complementary(const color_rgb_t * rgb, color_rgb_t * comp_rgb)¶ Calculate the complementary color of a given rgb color.
Note
Complementary color calculation according to adobe illustator calculations. See https://helpx.adobe.com/illustrator/using/adjusting-colors.html
Parameters
rgb: Input rgb color. Must be NOT NULL comp_rgb: Output rgb color, result of the complementary color calculation. Must be NOT NULL
-
struct
color_rgb_t¶ Data-structure describing a RGB color.
-
uint8_t
r¶ red value [0 - 255]
-
uint8_t
g¶ green value [0 - 255]
-
uint8_t
b¶ blue value [0 - 255]
-
uint8_t
-
struct
color_rgba_t¶ RGBA color value.
-
color_rgb_t
color¶ RGB value.
-
uint8_t
alpha¶ alpha value [0 - 255]
-
color_rgb_t