31 #define SPECLIST_TAG rgbcolor
32 #define SPECLIST_TYPE struct rgbcolor
35 #define rgbcolor_list_iterate(rgbcolorlist, prgbcolor) \
36 TYPED_LIST_ITERATE(struct rgbcolor, rgbcolorlist, prgbcolor)
37 #define rgbcolor_list_iterate_end LIST_ITERATE_END
41 #define CHECK_RGBCOLOR(_str, _c, _colorname) \
43 int _color_save = _c; \
45 _c = CLIP(0, _c, 255); \
46 if (_c != _color_save) { \
47 qCritical("Invalid value for '%s' in color definition '%s' (%d). " \
48 "Setting it to '%d'.", \
49 _colorname, _str, _color_save, _c); \
52 #define rgbcolor_check(_str, _r, _g, _b) \
54 CHECK_RGBCOLOR(_str, _r, "red"); \
55 CHECK_RGBCOLOR(_str, _g, "green"); \
56 CHECK_RGBCOLOR(_str, _b, "blue"); \
66 const char *path, ...)
69 const struct
rgbcolor *prgbcolor, const
char *path, ...)
bool rgbcolor_from_hex(struct rgbcolor **prgbcolor, const char *hex)
Convert a hex string into a rgb color.
void rgbcolor_destroy(struct rgbcolor *prgbcolor)
Free rgbcolor structure.
bool rgbcolors_are_equal(const struct rgbcolor *c1, const struct rgbcolor *c2)
Test whether two rgbcolor structures represent the exact same color value.
struct rgbcolor * rgbcolor_new(int r, int g, int b)
Allocate new rgbcolor structure.
bool rgbcolor_load(struct section_file *file, struct rgbcolor **prgbcolor, const char *path,...) fc__attribute((__format__(__printf__
bool void bool rgbcolor_to_hex(const struct rgbcolor *prgbcolor, char *hex, size_t hex_len)
Convert a rgb color to a hex string (like 0xff0000 for red [255, 0, 0]).
bool void rgbcolor_save(struct section_file *file, const struct rgbcolor *prgbcolor, const char *path,...) fc__attribute((__format__(__printf__
int rgbcolor_brightness_score(struct rgbcolor *prgbcolor)
Return a number indicating the perceptual brightness of this color relative to others (larger is brig...
struct rgbcolor * rgbcolor_copy(const struct rgbcolor *prgbcolor)
Allocate new rgbcolor structure and make it copy of one given as input.
int fc__attribute((nonnull(1, 3)))