-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolors.h
454 lines (409 loc) · 7.64 KB
/
colors.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
//This is just to offload color definitions to another file so I don't need to scroll so much in the main file.
#ifndef colors_h
#define colors_h
#include <Arduino.h>
//this is the most colors a single rainbow can have
#define MAX_RAINBOW_COLORS 12
//a structure for holding rainbows called rainbow:
struct rainbow {
uint32_t colors[MAX_RAINBOW_COLORS];
uint8_t num_colors;
};
//simple function for converting RGB into uint32_t used by Adafruit_NeoPixel
uint32_t Color(uint8_t r, uint8_t g, uint8_t b);
//this is a general purpose function for mapping a color transition between two colors (uint32_t) based on a desired position, a starting position, and an ending position.
uint32_t color_map(int x, int in_min, int in_max, uint32_t start_color, uint32_t end_color);
//named color definitions:
const uint32_t red = Color(255, 0, 0);
const uint32_t orange = Color(255, 127, 0);
const uint32_t yellow = Color(255, 255, 0);
const uint32_t yellow_green = Color(127, 255, 0);
const uint32_t green = Color(0, 255, 0);
const uint32_t green_blue = Color(0, 255, 127);
const uint32_t sky_blue = Color(0, 255, 255);
const uint32_t deep_blue = Color(0, 127, 255);
const uint32_t blue = Color(0, 0, 255);
const uint32_t purple_blue = Color(127, 0, 255);
const uint32_t purple = Color(255, 0, 255);
const uint32_t dark_purple = Color(255, 0, 127);
const uint32_t white = Color(255,255,255);
const uint32_t off = Color(0, 0, 0);
//a couple 'rainbows' for simple on/off functionality.
const rainbow r_off = {
.colors = {
off
},
.num_colors = 1
};
const rainbow r_on = {
.colors = {
white
},
.num_colors = 1
};
const rainbow r_red = {
.colors = {
red
},
.num_colors = 1
};
const rainbow r_orange = {
.colors = {
orange
},
.num_colors = 1
};
const rainbow r_yellow = {
.colors = {
yellow
},
.num_colors = 1
};
const rainbow r_yellow_green = {
.colors = {
yellow_green
},
.num_colors = 1
};
const rainbow r_green = {
.colors = {
green
},
.num_colors = 1
};
const rainbow r_green_blue = {
.colors = {
green_blue
},
.num_colors = 1
};
const rainbow r_sky_blue = {
.colors = {
sky_blue
},
.num_colors = 1
};
const rainbow r_deep_blue = {
.colors = {
deep_blue
},
.num_colors = 1
};
const rainbow r_blue = {
.colors = {
blue
},
.num_colors = 1
};
const rainbow r_purple_blue = {
.colors = {
purple_blue
},
.num_colors = 1
};
const rainbow r_purple = {
.colors = {
purple
},
.num_colors = 1
};
const rainbow r_dark_purple = {
.colors = {
dark_purple
},
.num_colors = 1
};
const rainbow r_dark_grey = {
.colors = {
Color(32,32,32)
},
.num_colors = 1
};
//recommended for use with LC_FG_VU_METER modes on a LightingControl setup, but not required.
//Adjust the ratio of green to yellow to red to your liking.
const rainbow r_vu = {
.colors = {
green,
green,
green,
green,
green,
green,
yellow,
yellow,
red
},
.num_colors = 9
};
//red and dark red pattern
const rainbow r_dark_red_pattern = {
.colors = {
Color(127,0,0),
Color(64,0,0),
Color(127,0,0),
Color(64,0,0),
Color(127,0,0),
Color(64,0,0),
},
.num_colors = 6
};
//yellow and dark yellow pattern
const rainbow r_dark_yellow_pattern = {
.colors = {
Color(127,127,0),
Color(64,64,0),
Color(127,127,0),
Color(64,64,0),
Color(127,127,0),
Color(64,64,0),
},
.num_colors = 6
};
//sky blue and dark sky blue pattern
const rainbow r_dark_sky_blue_pattern = {
.colors = {
Color(0,127,127),
Color(0,64,64),
Color(0,127,127),
Color(0,64,64),
Color(0,127,127),
Color(0,64,64),
},
.num_colors = 6
};
//purple and dark purple pattern
const rainbow r_dark_purple_pattern = {
.colors = {
Color(127,0,127),
Color(64,0,64),
Color(127,0,127),
Color(64,0,64),
Color(127,0,127),
Color(64,0,64),
},
.num_colors = 6
};
//green and dark green pattern
const rainbow r_dark_green_pattern = {
.colors = {
Color(0,127,0),
Color(0,64,0),
Color(0,127,0),
Color(0,64,0),
Color(0,127,0),
Color(0,64,0),
},
.num_colors = 6
};
//blue and dark blue pattern
const rainbow r_dark_blue_pattern = {
.colors = {
Color(0,0,127),
Color(0,0,64),
Color(0,0,127),
Color(0,0,64),
Color(0,0,127),
Color(0,0,64),
},
.num_colors = 6
};
//white and grey pattern
const rainbow r_white_grey_pattern = {
.colors = {
white,
Color(64,64,64),
white,
Color(64,64,64),
white,
Color(64,64,64)
},
.num_colors = 6
};
//this is the traditional roygbiv rainbow pattern
const rainbow r_roygbiv = {
.colors = {
red,
yellow,
green,
sky_blue,
blue,
purple
},
.num_colors = 6
};
//rainbow is a double rainbow of r3
const rainbow r_double_roygbiv = {
.colors = {
red,
yellow,
green,
sky_blue,
blue,
purple,
red,
yellow,
green,
sky_blue,
blue,
purple
},
.num_colors = 12
};
//the primary colors red, blue and yellow:
const rainbow r_rby = {
.colors = {
red,
off,
yellow,
off,
blue,
off
},
.num_colors = 6
};
//the secondary colors orange, green and purple:
const rainbow r_ogp = {
.colors = {
off,
orange,
off,
green,
off,
purple
},
.num_colors = 6
};
//red green and blue
const rainbow r_rgb = {
.colors = {
off,
red,
off,
green,
off,
blue
},
.num_colors = 6
};
//blue and yellow
const rainbow r_by = {
.colors = {
off,
yellow,
off,
blue,
off,
yellow,
off,
blue
},
.num_colors = 8
};
//red and sky_blue
const rainbow r_rb = {
.colors = {
off,
red,
off,
sky_blue,
off,
red,
off,
sky_blue
},
.num_colors = 8
};
//Orange and deep_blue
const rainbow r_ob = {
.colors = {
off,
orange,
off,
deep_blue,
off,
orange,
off,
deep_blue
},
.num_colors = 8
};
//blue and white pattern
const rainbow r_bw = {
.colors = {
white,
sky_blue,
blue,
deep_blue,
white,
sky_blue,
blue,
deep_blue
},
.num_colors = 8
};
//red and white pattern
const rainbow r_rw = {
.colors = {
white,
Color(127,0,0),
red,
Color(127,0,0),
white,
Color(127,0,0),
red,
Color(127,0,0)
},
.num_colors = 8
};
//green and white pattern
const rainbow r_gw = {
.colors = {
white,
Color(0,127,0),
green,
Color(0,127,0),
white,
Color(0,127,0),
green,
Color(0,127,0)
},
.num_colors = 8
};
//this is an array of all the rainbows above for use in whatever lighting animation switchers you have:
const uint16_t num_rainbows = 34;
const rainbow rb_array[num_rainbows] = {r_off, //0
r_on, //1
r_vu, //2
r_red, //3
r_orange, //4
r_yellow, //5
r_yellow_green, //6
r_green, //7
r_green_blue, //8
r_sky_blue, //9
r_deep_blue, //10
r_blue, //11
r_purple_blue, //12
r_purple, //13
r_dark_purple, //14
r_dark_grey, //15
r_dark_red_pattern, //16
r_dark_yellow_pattern, //17
r_dark_sky_blue_pattern, //18
r_dark_purple_pattern, //19
r_dark_green_pattern, //20
r_dark_blue_pattern, //21
r_white_grey_pattern, //22
r_roygbiv, //23
r_double_roygbiv, //24
r_rby, //25
r_ogp, //26
r_rgb, //27
r_by, //28
r_rb, //29
r_ob, //30
r_bw, //31
r_rw, //32
r_gw, //33
};
#endif