c-color-names main header file. Defines the API of c-color-names.
More...
#include <stdint.h>
Go to the source code of this file.
|
int | color_name_exists (const char *color_name) |
|
int | color_name_get_rgb_string (const char *color_name, char *color_hex_str) |
|
int | color_name_get_rgb (const char *color_name, uint8_t *r, uint8_t *g, uint8_t *b) |
|
const char * | color_name_find_rgb (uint8_t r, uint8_t g, uint8_t b) |
|
int | color_name_get_hsv (const char *color_name, float *h, float *s, float *v) |
|
const char * | color_name_find_hsv (float h, float s, float v) |
|
const char * | color_name_find_hex (const char *hex) |
|
c-color-names main header file. Defines the API of c-color-names.
◆ color_name_exists()
int color_name_exists |
( |
const char * |
color_name | ) |
|
check if the name exists in the color list. color name should be lowercase, other wise match might fail.
- Parameters
-
color_name | name of the color to look for (lowercase chars only) |
- Returns
- int 0 or 1 indicating whether color name found
◆ color_name_find_hex()
const char* color_name_find_hex |
( |
const char * |
hex | ) |
|
find the color name for the given color hex string in format #rrggbb. returns NULL if color is not found.
- Parameters
-
hex | hex string (format #rrggbb) of the color to be looked up. must be exactly 7 chars in length. |
- Returns
- color name (NULL if not found)
◆ color_name_find_hsv()
const char* color_name_find_hsv |
( |
float |
h, |
|
|
float |
s, |
|
|
float |
v |
|
) |
| |
find the color name for the given h,s,v triplet. returns NULL if color is not found.
- Parameters
-
- Returns
- color name (NULL if not found)
◆ color_name_find_rgb()
const char* color_name_find_rgb |
( |
uint8_t |
r, |
|
|
uint8_t |
g, |
|
|
uint8_t |
b |
|
) |
| |
find the color name for the given r,g,b triplet. returns NULL if color is not found.
- Parameters
-
r | red value |
g | green value |
b | blue value |
- Returns
- color name (NULL if not found)
◆ color_name_get_hsv()
int color_name_get_hsv |
( |
const char * |
color_name, |
|
|
float * |
h, |
|
|
float * |
s, |
|
|
float * |
v |
|
) |
| |
find the hsv values for the given color name if found
- Parameters
-
color_name | name of the color to look for (lowercase chars only) |
h | hue |
s | saturation |
v | value |
- Returns
- int 0 or 1 indicating whether color name found.
◆ color_name_get_rgb()
int color_name_get_rgb |
( |
const char * |
color_name, |
|
|
uint8_t * |
r, |
|
|
uint8_t * |
g, |
|
|
uint8_t * |
b |
|
) |
| |
find the rgb values for the given color name if found
- Parameters
-
color_name | name of the color to look for (lowercase chars only) |
r | red value |
g | green value |
b | blue value |
- Returns
- int 0 or 1 indicating whether color name found.
◆ color_name_get_rgb_string()
int color_name_get_rgb_string |
( |
const char * |
color_name, |
|
|
char * |
color_hex_str |
|
) |
| |
find the hex string for the given color name if found
- Parameters
-
color_name | name of the color to look for (lowercase chars only) |
color_hexstr | string of length 8. it will contain the hexstring in format #xxxxxx if color name found, unchanged otherwise. |
- Returns
- int 0 or 1 indicating whether color name found