c-color-names  v0.1.0-alpha.1
Color Names API in C
color_names.h
Go to the documentation of this file.
1 /*
2 
3 ############### c-color-names License
4 
5 MIT License
6 
7 Copyright (c) 2022 Abhishek Mishra <https://github.com/abhishekmishra>
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in all
17 copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 SOFTWARE.
26 
27 ############### color-names License
28 
29 MIT License
30 
31 Copyright (c) 2017 David Aerne
32 
33 Permission is hereby granted, free of charge, to any person obtaining a copy
34 of this software and associated documentation files (the "Software"), to deal
35 in the Software without restriction, including without limitation the rights
36 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37 copies of the Software, and to permit persons to whom the Software is
38 furnished to do so, subject to the following conditions:
39 
40 The above copyright notice and this permission notice shall be included in all
41 copies or substantial portions of the Software.
42 
43 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
47 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
48 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
49 SOFTWARE.
50 
51 */
52 
58 #ifndef __COLOR_NAMES_H__
59 #define __COLOR_NAMES_H__
60 
61 #include <stdint.h>
62 
63 #ifdef __cplusplus
64 extern "C"
65 {
66 #endif
67 
75 int color_name_exists(const char *color_name);
76 
85 int color_name_get_rgb_string(const char *color_name, char *color_hex_str);
86 
96 int color_name_get_rgb(const char *color_name, uint8_t *r, uint8_t *g,
97  uint8_t *b);
98 
108 const char* color_name_find_rgb(uint8_t r, uint8_t g, uint8_t b);
109 
119 int color_name_get_hsv(const char *color_name, float *h, float *s,
120  float *v);
121 
131 const char* color_name_find_hsv(float h, float s, float v);
132 
141 const char* color_name_find_hex(const char* hex);
142 
143 #ifdef __cplusplus
144 }
145 #endif
146 
147 #endif //__COLOR_NAMES_H__
int color_name_get_rgb_string(const char *color_name, char *color_hex_str)
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)
int color_name_exists(const char *color_name)
const char * color_name_find_hex(const char *hex)
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)