mikroSDK Reference Manual
gl_colors.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2023 MikroElektronika d.o.o.
4 ** Contact: https://www.mikroe.com/contact
5 **
6 ** This file is part of the mikroSDK package
7 **
8 ** Commercial License Usage
9 **
10 ** Licensees holding valid commercial NECTO compilers AI licenses may use this
11 ** file in accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The MikroElektronika Company.
14 ** For licensing terms and conditions see
15 ** https://www.mikroe.com/legal/software-license-agreement.
16 ** For further information use the contact form at
17 ** https://www.mikroe.com/contact.
18 **
19 **
20 ** GNU Lesser General Public License Usage
21 **
22 ** Alternatively, this file may be used for
23 ** non-commercial projects under the terms of the GNU Lesser
24 ** General Public License version 3 as published by the Free Software
25 ** Foundation: https://www.gnu.org/licenses/lgpl-3.0.html.
26 **
27 ** The above copyright notice and this permission notice shall be
28 ** included in all copies or substantial portions of the Software.
29 **
30 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31 ** OF MERCHANTABILITY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
32 ** TO THE WARRANTIES FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
34 ** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
35 ** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
36 ** OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 **
38 ****************************************************************************/
39 
44 #ifndef _GL_COLORS_H_
45 #define _GL_COLORS_H_
46 
47 #include <stdint.h>
48 
49 #ifdef __cplusplus
50 extern "C"{
51 #endif
52 
56 typedef uint16_t gl_color_t;
57 
61 #define GL_HEX2COLOR( hex ) ((gl_color_t)((((hex) & 0xF80000)>>8) | (((hex) & 0x00FC00)>>5) | (((hex) & 0x0000F8)>>3)))
62 
66 #define GL_RGB2COLOR( r, g, b ) (gl_color_t) ((((gl_color_t)r >> 3) << 11) | (((gl_color_t)g >> 2) << 5) | ((gl_color_t)b >> 3))
67 
71 #define GL_RED_OF( c ) (((gl_color_t)c >> 11) << 3)
72 
76 #define GL_GREEN_OF( c ) (((gl_color_t)c >> 5) << 2)
77 
81 #define GL_BLUE_OF( c ) ((gl_color_t)c << 3)
82 
86 #define GL_LUMA_OF( c ) ((GL_RED_OF(c)+((gl_color_t)GL_GREEN_OF(c)<<1)+GL_BLUE_OF(c))>>2)
87 
91 enum gl_palette
92 {
95  GL_AQUA = GL_HEX2COLOR(0x00FFFF),
97  GL_AZURE = GL_HEX2COLOR(0xF0FFFF),
98  GL_BEIGE = GL_HEX2COLOR(0xF5F5DC),
99  GL_BISQUE = GL_HEX2COLOR(0xFFE4C4),
100  GL_BLACK = GL_HEX2COLOR(0x000000),
102  GL_BLUE = GL_HEX2COLOR(0x0000FF),
104  GL_BROWN = GL_HEX2COLOR(0xA52A2A),
109  GL_CORAL = GL_HEX2COLOR(0xFF7F50),
111  GL_CORNSILK = GL_HEX2COLOR(0xFFF8DC),
112  GL_CRIMSON = GL_HEX2COLOR(0xDC143C),
113  GL_CYAN = GL_HEX2COLOR(0x00FFFF),
125  GL_DARK_RED = GL_HEX2COLOR(0x8B0000),
135  GL_DIM_GRAY = GL_HEX2COLOR(0x696969),
136  GL_DIM_GREY = GL_HEX2COLOR(0x696969),
141  GL_FUCHSIA = GL_HEX2COLOR(0xFF00FF),
144  GL_GOLD = GL_HEX2COLOR(0xFFD700),
146  GL_GRAY = GL_HEX2COLOR(0x808080),
147  GL_GREY = GL_HEX2COLOR(0x808080),
148  GL_GREEN = GL_HEX2COLOR(0x008000),
151  GL_HOT_PINK = GL_HEX2COLOR(0xFF69B4),
153  GL_INDIGO = GL_HEX2COLOR(0x4B0082),
154  GL_IVORY = GL_HEX2COLOR(0xFFFFF0),
155  GL_KHAKI = GL_HEX2COLOR(0xF0E68C),
156  GL_LAVENDER = GL_HEX2COLOR(0xE6E6FA),
175  GL_LIME = GL_HEX2COLOR(0x00FF00),
177  GL_LINEN = GL_HEX2COLOR(0xFAF0E6),
178  GL_MAGENTA = GL_HEX2COLOR(0xFF00FF),
179  GL_MAROON = GL_HEX2COLOR(0x800000),
192  GL_MOCCASIN = GL_HEX2COLOR(0xFFE4B5),
194  GL_NAVY = GL_HEX2COLOR(0x000080),
195  GL_OLD_LACE = GL_HEX2COLOR(0xFDF5E6),
196  GL_OLIVE = GL_HEX2COLOR(0x808000),
198  GL_ORANGE = GL_HEX2COLOR(0xFFA500),
200  GL_ORCHID = GL_HEX2COLOR(0xDA70D6),
207  GL_PERU = GL_HEX2COLOR(0xCD853F),
208  GL_PINK = GL_HEX2COLOR(0xFFC0CB),
209  GL_PLUM = GL_HEX2COLOR(0xDDA0DD),
211  GL_PURPLE = GL_HEX2COLOR(0x800080),
213  GL_RED = GL_HEX2COLOR(0xFF0000),
217  GL_SALMON = GL_HEX2COLOR(0xFA8072),
221  GL_SIENNA = GL_HEX2COLOR(0xA0522D),
222  GL_SILVER = GL_HEX2COLOR(0xC0C0C0),
223  GL_SKY_BLUE = GL_HEX2COLOR(0x87CEEB),
227  GL_SNOW = GL_HEX2COLOR(0xFFFAFA),
230  GL_TAN = GL_HEX2COLOR(0xD2B48C),
231  GL_TEAL = GL_HEX2COLOR(0x008080),
232  GL_THISTLE = GL_HEX2COLOR(0xD8BFD8),
233  GL_TOMATO = GL_HEX2COLOR(0xFF6347),
235  GL_VIOLET = GL_HEX2COLOR(0xEE82EE),
236  GL_WHEAT = GL_HEX2COLOR(0xF5DEB3),
237  GL_WHITE = GL_HEX2COLOR(0xFFFFFF),
239  GL_YELLOW = GL_HEX2COLOR(0xFFFF00),
240  GL_YELLOW_GREEN = GL_HEX2COLOR(0x9ACD32),
243  GL_YELLY_BEAN = GL_RGB2COLOR(219, 80, 74),
244  GL_CITRINE = GL_RGB2COLOR(227, 181, 5),
245  GL_PAYNES_GRAY = GL_RGB2COLOR(79, 109, 122),
247  GL_CHARLESTON_GREEN = GL_RGB2COLOR(36, 37, 48)
248 };
249 
250 #ifdef __cplusplus
251 } // extern "C"
252 #endif
253 
254 #endif // _GL_COLORS_H_
255 // ------------------------------------------------------------------------- END
GL_YELLY_BEAN
Definition: gl_colors.h:242
GL_GOLD
Definition: gl_colors.h:143
GL_DARK_SLATE_GREY
Definition: gl_colors.h:129
GL_SANDY_BROWN
Definition: gl_colors.h:217
gl_palette
gl_palette
Definition: gl_colors.h:90
GL_LIGHT_CORAL
Definition: gl_colors.h:160
GL_SNOW
Definition: gl_colors.h:226
GL_SLATE_GREY
Definition: gl_colors.h:225
GL_GRAY
Definition: gl_colors.h:145
GL_YELLOW_GREEN
Definition: gl_colors.h:239
GL_LIGHT_YELLOW
Definition: gl_colors.h:173
GL_BLUE
Definition: gl_colors.h:101
GL_AQUA
Definition: gl_colors.h:94
GL_SPRING_GREEN
Definition: gl_colors.h:227
GL_DODGER_BLUE
Definition: gl_colors.h:136
GL_CORNSILK
Definition: gl_colors.h:110
GL_SILVER
Definition: gl_colors.h:221
GL_OLIVE_DRAB
Definition: gl_colors.h:196
GL_LIGHT_SKY_BLUE
Definition: gl_colors.h:169
GL_LIME
Definition: gl_colors.h:174
GL_ROSY_BROWN
Definition: gl_colors.h:213
GL_CADET_BLUE
Definition: gl_colors.h:105
GL_LAWN_GREEN
Definition: gl_colors.h:157
GL_HOT_PINK
Definition: gl_colors.h:150
GL_CHOCOLATE
Definition: gl_colors.h:107
GL_DEEP_PINK
Definition: gl_colors.h:132
GL_TURQUOISE
Definition: gl_colors.h:233
GL_CORNFLOWER_BLUE
Definition: gl_colors.h:109
GL_GREEN
Definition: gl_colors.h:147
GL_RED
Definition: gl_colors.h:212
GL_AZURE
Definition: gl_colors.h:96
GL_ORANGE_RED
Definition: gl_colors.h:198
GL_NAVY
Definition: gl_colors.h:193
GL_DARK_GOLDEN_ROD
Definition: gl_colors.h:115
GL_MAROON
Definition: gl_colors.h:178
GL_DARK_TURQUOISE
Definition: gl_colors.h:130
GL_SEA_SHELL
Definition: gl_colors.h:219
GL_CHARLESTON_GREEN
Definition: gl_colors.h:246
GL_REBECCA_PURPLE
Definition: gl_colors.h:211
GL_YELLOW
Definition: gl_colors.h:238
GL_ORANGE
Definition: gl_colors.h:197
GL_KHAKI
Definition: gl_colors.h:154
GL_DARK_CYAN
Definition: gl_colors.h:114
GL_LIGHT_GOLDEN_ROD_YELLOW
Definition: gl_colors.h:162
GL_PINK
Definition: gl_colors.h:207
GL_LIGHT_GRAY
Definition: gl_colors.h:163
GL_DARK_BLUE
Definition: gl_colors.h:113
GL_POWDER_BLUE
Definition: gl_colors.h:209
GL_MEDIUM_SLATE_BLUE
Definition: gl_colors.h:184
GL_ROYAL_BLUE
Definition: gl_colors.h:214
GL_SEA_GREEN
Definition: gl_colors.h:218
GL_IVORY
Definition: gl_colors.h:153
GL_SADDLE_BROWN
Definition: gl_colors.h:215
GL_PEACH_PUFF
Definition: gl_colors.h:205
GL_MEDIUM_PURPLE
Definition: gl_colors.h:182
GL_MEDIUM_VIOLET_RED
Definition: gl_colors.h:187
GL_HONEY_DEW
Definition: gl_colors.h:149
GL_THISTLE
Definition: gl_colors.h:231
GL_CORAL
Definition: gl_colors.h:108
GL_DARK_RED
Definition: gl_colors.h:124
GL_MEDIUM_SPRING_GREEN
Definition: gl_colors.h:185
GL_DIM_GRAY
Definition: gl_colors.h:134
GL_LIGHT_SALMON
Definition: gl_colors.h:167
GL_SLATE_GRAY
Definition: gl_colors.h:224
GL_DARK_SLATE_GRAY
Definition: gl_colors.h:128
GL_DARK_SLATE_BLUE
Definition: gl_colors.h:127
GL_WHITE_SMOKE
Definition: gl_colors.h:237
GL_LIGHT_PINK
Definition: gl_colors.h:166
GL_PALE_GOLDEN_ROD
Definition: gl_colors.h:200
GL_DARK_ORANGE
Definition: gl_colors.h:122
GL_LAVENDER_BLUSH
Definition: gl_colors.h:156
GL_SIENNA
Definition: gl_colors.h:220
GL_BROWN
Definition: gl_colors.h:103
GL_GHOST_WHITE
Definition: gl_colors.h:142
GL_GAINSBORO
Definition: gl_colors.h:141
GL_INDIGO
Definition: gl_colors.h:152
GL_DARK_GUNMENT
Definition: gl_colors.h:245
GL_DARK_SEA_GREEN
Definition: gl_colors.h:126
GL_HEX2COLOR
#define GL_HEX2COLOR(hex)
Definition: gl_colors.h:60
GL_DARK_GREY
Definition: gl_colors.h:117
GL_TOMATO
Definition: gl_colors.h:232
GL_RGB2COLOR
#define GL_RGB2COLOR(r, g, b)
Definition: gl_colors.h:65
GL_MINT_CREAM
Definition: gl_colors.h:189
GL_LIGHT_SLATE_GREY
Definition: gl_colors.h:171
GL_FOREST_GREEN
Definition: gl_colors.h:139
GL_LIGHT_GREY
Definition: gl_colors.h:164
GL_DARK_MAGENTA
Definition: gl_colors.h:120
GL_OLIVE
Definition: gl_colors.h:195
GL_GREY
Definition: gl_colors.h:146
GL_LIGHT_SEA_GREEN
Definition: gl_colors.h:168
GL_MEDIUM_SEA_GREEN
Definition: gl_colors.h:183
gl_color_t
uint16_t gl_color_t
Definition: gl_colors.h:55
GL_MEDIUM_AQUA_MARINE
Definition: gl_colors.h:179
GL_VIOLET
Definition: gl_colors.h:234
GL_FIRE_BRICK
Definition: gl_colors.h:137
GL_LEMON_CHIFFON
Definition: gl_colors.h:158
GL_BEIGE
Definition: gl_colors.h:97
GL_STEEL_BLUE
Definition: gl_colors.h:228
GL_LIGHT_BLUE
Definition: gl_colors.h:159
GL_PALE_TURQUOISE
Definition: gl_colors.h:202
GL_LIME_GREEN
Definition: gl_colors.h:175
GL_EAGLE_GREEN
Definition: gl_colors.h:241
GL_GOLDEN_ROD
Definition: gl_colors.h:144
GL_DARK_GRAY
Definition: gl_colors.h:116
GL_PAYNES_GRAY
Definition: gl_colors.h:244
GL_DARK_OLIVE_GREEN
Definition: gl_colors.h:121
GL_LIGHT_GREEN
Definition: gl_colors.h:165
GL_MEDIUM_BLUE
Definition: gl_colors.h:180
GL_BURLY_WOOD
Definition: gl_colors.h:104
GL_DARK_VIOLET
Definition: gl_colors.h:131
GL_SLATE_BLUE
Definition: gl_colors.h:223
GL_CHARTREUSE
Definition: gl_colors.h:106
GL_MAGENTA
Definition: gl_colors.h:177
GL_DARK_GREEN
Definition: gl_colors.h:118
GL_LIGHT_SLATE_GRAY
Definition: gl_colors.h:170
GL_FUCHSIA
Definition: gl_colors.h:140
GL_MOCCASIN
Definition: gl_colors.h:191
GL_BLACK
Definition: gl_colors.h:99
GL_PURPLE
Definition: gl_colors.h:210
GL_NAVAJO_WHITE
Definition: gl_colors.h:192
GL_DARK_SALMON
Definition: gl_colors.h:125
GL_OLD_LACE
Definition: gl_colors.h:194
GL_AQUAMARINE
Definition: gl_colors.h:95
GL_BLANCHED_ALMOND
Definition: gl_colors.h:100
GL_PAPAYA_WHIP
Definition: gl_colors.h:204
GL_TEAL
Definition: gl_colors.h:230
GL_INDIAN_RED
Definition: gl_colors.h:151
GL_PLUM
Definition: gl_colors.h:208
GL_WHEAT
Definition: gl_colors.h:235
GL_LIGHT_CYAN
Definition: gl_colors.h:161
GL_ALICE_BLUE
Definition: gl_colors.h:92
GL_CITRINE
Definition: gl_colors.h:243
GL_CYAN
Definition: gl_colors.h:112
GL_FLORAL_WHITE
Definition: gl_colors.h:138
GL_SALMON
Definition: gl_colors.h:216
GL_MISTY_ROSE
Definition: gl_colors.h:190
GL_PALE_VIOLET_RED
Definition: gl_colors.h:203
GL_LINEN
Definition: gl_colors.h:176
GL_DARK_KHAKI
Definition: gl_colors.h:119
GL_CRIMSON
Definition: gl_colors.h:111
GL_MEDIUM_ORCHID
Definition: gl_colors.h:181
GL_LAVENDER
Definition: gl_colors.h:155
GL_SKY_BLUE
Definition: gl_colors.h:222
GL_DEEP_SKY_BLUE
Definition: gl_colors.h:133
GL_BISQUE
Definition: gl_colors.h:98
GL_GREEN_YELLOW
Definition: gl_colors.h:148
GL_DIM_GREY
Definition: gl_colors.h:135
GL_DARK_ORCHID
Definition: gl_colors.h:123
GL_MIDNIGHT_BLUE
Definition: gl_colors.h:188
GL_MEDIUM_TURQUOISE
Definition: gl_colors.h:186
GL_PALE_GREEN
Definition: gl_colors.h:201
GL_ORCHID
Definition: gl_colors.h:199
GL_PERU
Definition: gl_colors.h:206
GL_TAN
Definition: gl_colors.h:229
GL_LIGHT_STEEL_BLUE
Definition: gl_colors.h:172
GL_BLUE_VIOLET
Definition: gl_colors.h:102
GL_ANTIQUE_WHITE
Definition: gl_colors.h:93
GL_WHITE
Definition: gl_colors.h:236