|
| 1 | +/*! |
| 2 | + * @file FusionColours.h |
| 3 | + * |
| 4 | + * @copyright Gonezo Fusion Lightguns |
| 5 | + * @copyright GNU Lesser General Public License |
| 6 | + * |
| 7 | + * @author Mike Lynch |
| 8 | + * @author Gonezo |
| 9 | + * @version V2.00 |
| 10 | + * @date 2023 |
| 11 | + */ |
| 12 | + |
| 13 | +#ifndef _FUSIONCOLOURS_H_ |
| 14 | +#define _FUSIONCOLOURS_H_ |
| 15 | + |
| 16 | +#include <stdint.h> |
| 17 | + |
| 18 | +// macro to scale an 8 bit colour value by an 8 bit value |
| 19 | +// as seen by the math, 255 means full value |
| 20 | +#define COLOR_BRI_ADJ_COLOR(brightness, color) ((((brightness) * ((color) & 0xFF)) / 255) & 0xFF) |
| 21 | +//#define COLOR_BRI_ADJ_COLOR(brightness, color) (color) |
| 22 | + |
| 23 | +// macro to scale a 32-bit RGBW word with an 8 bit brightness value |
| 24 | +#define COLOR_BRI_ADJ_RGB(brightness, rgb) COLOR_BRI_ADJ_COLOR(brightness, rgb) \ |
| 25 | + | (COLOR_BRI_ADJ_COLOR(brightness, (rgb >> 8)) << 8) \ |
| 26 | + | (COLOR_BRI_ADJ_COLOR(brightness, (rgb >> 16)) << 16) \ |
| 27 | + | (COLOR_BRI_ADJ_COLOR(brightness, (rgb >> 24)) << 24) |
| 28 | + |
| 29 | +// some distinct colours from Wikipedia https://en.wikipedia.org/wiki/Lists_of_colors |
| 30 | +// also adjusted the brightness to make them look even more distinct on an ItsyBitsy DotStar |
| 31 | +// ... yeah I spent too much time on this |
| 32 | +namespace WikiColor { |
| 33 | + constexpr uint32_t Amber = COLOR_BRI_ADJ_RGB(130, 0xFFBF00); |
| 34 | + constexpr uint32_t Blue = COLOR_BRI_ADJ_RGB(225, 0x0000FF); |
| 35 | + constexpr uint32_t Carnation_pink = COLOR_BRI_ADJ_RGB(165, 0xFFA6C9); |
| 36 | + constexpr uint32_t Cerulean_blue = COLOR_BRI_ADJ_RGB(255, 0x2A52BE); |
| 37 | + constexpr uint32_t Cornflower_blue = COLOR_BRI_ADJ_RGB(175, 0x6495ED); |
| 38 | + constexpr uint32_t Cyan = COLOR_BRI_ADJ_RGB(145, 0x00FFFF); |
| 39 | + constexpr uint32_t Electric_indigo = COLOR_BRI_ADJ_RGB(235, 0x6F00FF); |
| 40 | + constexpr uint32_t Ghost_white = COLOR_BRI_ADJ_RGB(135, 0xF8F8FF); |
| 41 | + constexpr uint32_t Golden_yellow = COLOR_BRI_ADJ_RGB(135, 0xFFDF00); |
| 42 | + constexpr uint32_t Green = COLOR_BRI_ADJ_RGB(140, 0x00FF00); |
| 43 | + constexpr uint32_t Green_Lizard = COLOR_BRI_ADJ_RGB(145, 0xA7F432); |
| 44 | + constexpr uint32_t Magenta = COLOR_BRI_ADJ_RGB(140, 0xFF00FF); |
| 45 | + constexpr uint32_t Orange = COLOR_BRI_ADJ_RGB(150, 0xFF7F00); |
| 46 | + constexpr uint32_t Red = COLOR_BRI_ADJ_RGB(145, 0xFF0000); |
| 47 | + constexpr uint32_t Salmon = COLOR_BRI_ADJ_RGB(175, 0xFA8072); |
| 48 | + constexpr uint32_t Yellow = COLOR_BRI_ADJ_RGB(135, 0xFFFF00); |
| 49 | +}; |
| 50 | + |
| 51 | +#endif // _FUSIONCOLOURS_H_ |
0 commit comments