aboutsummaryrefslogtreecommitdiff
path: root/colors.h
blob: 34c409578a5e40587db20a58924b1ce012e350bb (plain)
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
// -*- mode: c++ -*- 
#pragma once
 
// copied from https://github.com/jdlien/Kaleidoscope-LEDEffect-FunctionalColor/blob/master/src/colors.h 
 
static constexpr cRGB warmwhite = CRGB(255250200);
static constexpr cRGB aliceblue = CRGB(240248255);
static constexpr cRGB antiquewhite = CRGB(250235215);
static constexpr cRGB aqua = CRGB(0255255);
static constexpr cRGB aquamarine = CRGB(127255212);
static constexpr cRGB azure = CRGB(240255255);
static constexpr cRGB beige = CRGB(245245220);
static constexpr cRGB bisque = CRGB(255228196);
static constexpr cRGB black = CRGB(000);
static constexpr cRGB blanchedalmond = CRGB(255235205);
static constexpr cRGB blue = CRGB(00255);
static constexpr cRGB blueviolet = CRGB(13843226);
static constexpr cRGB brown = CRGB(1654242); //Looks more like dim red 
static constexpr cRGB burlywood = CRGB(222184135);
static constexpr cRGB cadetblue = CRGB(95158160);
static constexpr cRGB chartreuse = CRGB(1272550);
static constexpr cRGB chocolate = CRGB(21010530);
static constexpr cRGB coral = CRGB(25512780);
static constexpr cRGB cornflowerblue = CRGB(100149237);
static constexpr cRGB cornsilk = CRGB(255248220);
static constexpr cRGB crimson = CRGB(2202060);
static constexpr cRGB cyan = CRGB(0255255);
static constexpr cRGB darkblue = CRGB(00139);
static constexpr cRGB darkcyan = CRGB(0139139);
static constexpr cRGB darkgoldenrod = CRGB(18413411);
static constexpr cRGB darkgray = CRGB(169169169);
static constexpr cRGB darkgrey = CRGB(169169169);
static constexpr cRGB darkgreen = CRGB(01000);
static constexpr cRGB darkkhaki = CRGB(189183107);
static constexpr cRGB darkmagenta = CRGB(1390139);
static constexpr cRGB darkolivegreen = CRGB(8510747);
static constexpr cRGB darkorange = CRGB(2551400);
static constexpr cRGB darkorchid = CRGB(15350204);
static constexpr cRGB darkred = CRGB(13900);
static constexpr cRGB darksalmon = CRGB(233150122);
static constexpr cRGB darkseagreen = CRGB(143188143);
static constexpr cRGB darkslateblue = CRGB(7261139);
static constexpr cRGB darkslategray = CRGB(477979);
static constexpr cRGB darkslategrey = CRGB(477979);
static constexpr cRGB darkturquoise = CRGB(0206209);
static constexpr cRGB darkviolet = CRGB(1480211);
static constexpr cRGB deeppink = CRGB(25520147);
static constexpr cRGB deepskyblue = CRGB(0191255);
static constexpr cRGB dimgray = CRGB(105105105);
static constexpr cRGB dimgrey = CRGB(105105105);
static constexpr cRGB dodgerblue = CRGB(30144255);
static constexpr cRGB firebrick = CRGB(1783434);
static constexpr cRGB floralwhite = CRGB(255250240);
static constexpr cRGB forestgreen = CRGB(3413934);
static constexpr cRGB fuchsia = CRGB(2550255);
static constexpr cRGB gainsboro = CRGB(220220220);
static constexpr cRGB ghostwhite = CRGB(248248255);
static constexpr cRGB gold = CRGB(2552150);
static constexpr cRGB goldenrod = CRGB(21816532);
static constexpr cRGB gray = CRGB(128128128);
static constexpr cRGB grey = CRGB(128128128);
static constexpr cRGB green = CRGB(01280);
static constexpr cRGB greenyellow = CRGB(17325547);
static constexpr cRGB honeydew = CRGB(240255240);
static constexpr cRGB hotpink = CRGB(255105180);
static constexpr cRGB indianred = CRGB(2059292);
static constexpr cRGB indigo = CRGB(750130);
static constexpr cRGB ivory = CRGB(255255240);
static constexpr cRGB khaki = CRGB(240230140);
static constexpr cRGB lavender = CRGB(230230250);
static constexpr cRGB lavenderblush = CRGB(255240245);
static constexpr cRGB lawngreen = CRGB(1242520);
static constexpr cRGB lemonchiffon = CRGB(255250205);
static constexpr cRGB lightblue = CRGB(173216230);
static constexpr cRGB lightcoral = CRGB(240128128);
static constexpr cRGB lightcyan = CRGB(224255255);
static constexpr cRGB lightgoldenrodyellow = CRGB(250250210);
static constexpr cRGB lightgray = CRGB(211211211);
static constexpr cRGB lightgrey = CRGB(211211211);
static constexpr cRGB lightgreen = CRGB(144238144);
static constexpr cRGB lightpink = CRGB(255182193);
static constexpr cRGB lightsalmon = CRGB(255160122);
static constexpr cRGB lightseagreen = CRGB(32178170);
static constexpr cRGB lightskyblue = CRGB(135206250);
static constexpr cRGB lightslategray = CRGB(119136153);
static constexpr cRGB lightslategrey = CRGB(119136153);
static constexpr cRGB lightsteelblue = CRGB(176196222);
static constexpr cRGB lightyellow = CRGB(255255224);
static constexpr cRGB lime = CRGB(02550);
static constexpr cRGB limegreen = CRGB(5020550);
static constexpr cRGB linen = CRGB(250240230);
static constexpr cRGB magenta = CRGB(2550255);
static constexpr cRGB maroon = CRGB(12800);
static constexpr cRGB mediumaquamarine = CRGB(102205170);
static constexpr cRGB mediumblue = CRGB(00205);
static constexpr cRGB mediumorchid = CRGB(18685211);
static constexpr cRGB mediumpurple = CRGB(147112219);
static constexpr cRGB mediumseagreen = CRGB(60179113);
static constexpr cRGB mediumslateblue = CRGB(123104238);
static constexpr cRGB mediumspringgreen = CRGB(0250154);
static constexpr cRGB mediumturquoise = CRGB(72209204);
static constexpr cRGB mediumvioletred = CRGB(19921133);
static constexpr cRGB midnightblue = CRGB(2525112);
static constexpr cRGB mintcream = CRGB(245255250);
static constexpr cRGB mistyrose = CRGB(255228225);
static constexpr cRGB moccasin = CRGB(255228181);
static constexpr cRGB navajowhite = CRGB(255222173);
static constexpr cRGB navy = CRGB(00128);
static constexpr cRGB oldlace = CRGB(253245230);
static constexpr cRGB olive = CRGB(1281280);
static constexpr cRGB olivedrab = CRGB(10714235);
static constexpr cRGB orange = CRGB(2551650);
// The original orangered looked exactly like red to me, so I adjusted 
//cRGB orangered = CRGB(255, 69, 0); 
static constexpr cRGB orangered = CRGB(2551000);
static constexpr cRGB orchid = CRGB(218112214);
static constexpr cRGB palegoldenrod = CRGB(238232170);
static constexpr cRGB palegreen = CRGB(152251152);
static constexpr cRGB paleturquoise = CRGB(175238238);
static constexpr cRGB palevioletred = CRGB(219112147);
static constexpr cRGB papayawhip = CRGB(255239213);
static constexpr cRGB peachpuff = CRGB(255218185);
static constexpr cRGB peru = CRGB(20513363);
static constexpr cRGB pink = CRGB(255192203);
static constexpr cRGB plum = CRGB(221160221);
static constexpr cRGB powderblue = CRGB(176224230);
static constexpr cRGB purple = CRGB(1280128);
static constexpr cRGB rebeccapurple = CRGB(10251153);
static constexpr cRGB red = CRGB(25500);
static constexpr cRGB rosybrown = CRGB(188143143);
static constexpr cRGB royalblue = CRGB(65105225);
static constexpr cRGB saddlebrown = CRGB(1396919);
static constexpr cRGB salmon = CRGB(250128114);
static constexpr cRGB sandybrown = CRGB(24416496);
static constexpr cRGB seagreen = CRGB(4613987);
static constexpr cRGB seashell = CRGB(255245238);
static constexpr cRGB sienna = CRGB(1608245);
static constexpr cRGB silver = CRGB(192192192);
static constexpr cRGB skyblue = CRGB(135206235);
static constexpr cRGB slateblue = CRGB(10690205);
static constexpr cRGB slategray = CRGB(112128144);
static constexpr cRGB slategrey = CRGB(112128144);
static constexpr cRGB snow = CRGB(255250250);
static constexpr cRGB springgreen = CRGB(0255127);
static constexpr cRGB steelblue = CRGB(70130180);
static constexpr cRGB tan = CRGB(210180140);
static constexpr cRGB teal = CRGB(0128128);
static constexpr cRGB thistle = CRGB(216191216);
static constexpr cRGB tomato = CRGB(2559971);
static constexpr cRGB turquoise = CRGB(64224208);
static constexpr cRGB violet = CRGB(238130238);
static constexpr cRGB wheat = CRGB(245222179);
static constexpr cRGB white = CRGB(255255255);
static constexpr cRGB whitesmoke = CRGB(245245245);
static constexpr cRGB yellow = CRGB(2552550);
static constexpr cRGB yellowgreen = CRGB(15420550);
 
// Not sure if this is the right place for this... 
 
// Function to dim the color from 0-255 (by default) or over a specified range 
// dims the specified color from 0 (off) to 255 (full) 
inline constexpr float brightnessScale(byte brightness, byte range=255) {
  return float(brightness)/float(range);
}
 
// dimLimit prevents small adjustments from completely shutting colors off, as they are not visible below 28. 
//if brightness is over about 51, and the *original* value for an rgb was over 80, set the new value to 28 if it would otherwise fall below that. 
inline constexpr byte dimLimit(byte brightness, byte rgbByte, byte range=255) {
  //Uncomment this line to bypass the dimming limiting that prevents lights from blacking out at moderate values 
  //return brightnessScale(brightness, range)*rgbByte; 
  return byte(brightnessScale(brightness, range) >= 0.20 && rgbByte >= 80 && brightnessScale(brightness, range)*rgbByte < 28)?28:brightnessScale(brightness, range)*rgbByte;
}
 
//Note that in practice, on the model01, 28 is the lowest value that actually lights up at all 
inline constexpr cRGB dim(const cRGB &color, byte brightness, byte range=255) {
  return CRGB(uint8_t(dimLimit(brightness, color.r, range)), 
              uint8_t(dimLimit(brightness, color.g, range)), 
              uint8_t(dimLimit(brightness, color.b, range)));
}