-
Notifications
You must be signed in to change notification settings - Fork 0
/
colour.go
231 lines (212 loc) · 7.77 KB
/
colour.go
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
package spectrum
type Colour struct {
Name string
RGB [3]float64
RGBui8 [3]uint8
RGBui32 uint32
XYZ [3]float64
Lab [3]float64
HSL [3]float64
CMY [3]float64
CMYK [4]float64
LUV [3]float64
}
// Colour constants
// https://www.rapidtables.com/web/color/RGB_Color.html
var (
Black = Colour{
Name: "Black",
RGB: [3]float64{0.00000000, 0.00000000, 0.00000000},
RGBui8: [3]uint8{0, 0, 0},
RGBui32: 0x000000,
XYZ: [3]float64{0.00000000, 0.00000000, 0.00000000},
Lab: [3]float64{0.00000000, 0.00000000, 0.00000000},
HSL: [3]float64{0.00000000, 0.00000000, 0.00000000},
CMY: [3]float64{1.00000000, 1.00000000, 1.00000000},
CMYK: [4]float64{0.00000000, 0.00000000, 0.00000000, 1.00000000},
}
White = Colour{
Name: "White",
RGB: [3]float64{1.00000000, 1.00000000, 1.00000000},
RGBui8: [3]uint8{255, 255, 255},
RGBui32: 0xffffff,
XYZ: [3]float64{0.95045600, 1.00000000, 1.08875400},
Lab: [3]float64{100.00000000, -0.00245494, 0.00465342},
HSL: [3]float64{0.00000000, 0.00000000, 1.00000000},
CMY: [3]float64{0.00000000, 0.00000000, 0.00000000},
CMYK: [4]float64{0.00000000, 0.00000000, 0.00000000, 0.00000000},
}
Red = Colour{
Name: "Red",
RGB: [3]float64{1.00000000, 0.00000000, 0.00000000},
RGBui8: [3]uint8{255, 0, 0},
RGBui32: 0xff0000,
XYZ: [3]float64{0.41245300, 0.21267100, 0.01933400},
Lab: [3]float64{53.240587944, 80.092308226, 67.20275104},
HSL: [3]float64{0.00000000, 1.00000000, 0.50000000},
CMY: [3]float64{0.00000000, 1.00000000, 1.00000000},
CMYK: [4]float64{0.00000000, 1.00000000, 1.00000000, 0.00000000},
}
Lime = Colour{
Name: "Lime",
RGB: [3]float64{0.00000000, 1.00000000, 0.00000000},
RGBui8: [3]uint8{0, 255, 0},
RGBui32: 0x00ff00,
XYZ: [3]float64{0.35758000, 0.71516000, 0.11919300},
Lab: [3]float64{87.73509949, -86.18302974, 83.17970318},
HSL: [3]float64{0.333333333, 1.00000000, 0.50000000},
CMY: [3]float64{1.00000000, 0.00000000, 1.00000000},
CMYK: [4]float64{1.00000000, 0.00000000, 1.00000000, 0.00000000},
}
Blue = Colour{
Name: "Blue",
RGB: [3]float64{0.00000000, 0.00000000, 1.00000000},
RGBui8: [3]uint8{0, 0, 255},
RGBui32: 0x0000ff,
XYZ: [3]float64{0.18042300, 0.07216900, 0.95022700},
Lab: [3]float64{32.29567257, 79.18559091, -107.85730021},
HSL: [3]float64{0.666666667, 1.00000000, 0.50000000},
CMY: [3]float64{1.00000000, 1.00000000, 0.00000000},
CMYK: [4]float64{1.00000000, 1.00000000, 0.00000000, 0.00000000},
}
Yellow = Colour{
Name: "Yellow",
RGB: [3]float64{1.00000000, 1.00000000, 0.00000000},
RGBui8: [3]uint8{255, 255, 0},
RGBui32: 0xffff00,
XYZ: [3]float64{0.77003300, 0.92783100, 0.13852700},
Lab: [3]float64{97.13950704, -21.55468102, 94.47812228},
HSL: [3]float64{0.166666667, 1.00000000, 0.50000000},
CMY: [3]float64{0.00000000, 0.00000000, 1.00000000},
CMYK: [4]float64{0.00000000, 0.00000000, 1.00000000, 0.00000000},
}
Cyan = Colour{
Name: "Cyan",
RGB: [3]float64{0.00000000, 1.00000000, 1.00000000},
RGBui8: [3]uint8{0, 255, 255},
RGBui32: 0x00ffff,
XYZ: [3]float64{0.53800300, 0.78732900, 1.06942000},
Lab: [3]float64{91.11330144, -48.09059623, -14.12632982},
HSL: [3]float64{0.50000000, 1.00000000, 0.50000000},
CMY: [3]float64{1.00000000, 0.00000000, 0.00000000},
CMYK: [4]float64{1.00000000, 0.00000000, 0.00000000, 0.00000000},
}
Magenta = Colour{
Name: "Magenta",
RGB: [3]float64{1.00000000, 0.00000000, 1.00000000},
RGBui8: [3]uint8{255, 0, 255},
RGBui32: 0xff00ff,
XYZ: [3]float64{0.59287600, 0.28484000, 0.96956100},
Lab: [3]float64{60.32350653, 98.23305386, -60.82101524},
HSL: [3]float64{0.833333333, 1.00000000, 0.50000000},
CMY: [3]float64{0.00000000, 1.00000000, 0.00000000},
CMYK: [4]float64{0.00000000, 1.00000000, 0.00000000, 0.00000000},
}
Silver = Colour{
Name: "Silver",
RGB: [3]float64{0.75294118, 0.75294118, 0.75294118},
RGBui8: [3]uint8{192, 192, 192},
RGBui32: 0xc0c0c0,
XYZ: [3]float64{0.50099974, 0.52711513, 0.57389871},
Lab: [3]float64{77.70436384, -0.00198255, 0.00375866},
HSL: [3]float64{0.00000000, 0.00000000, 0.75294118},
CMY: [3]float64{0.24705882, 0.24705882, 0.24705882},
CMYK: [4]float64{0.00000000, 0.00000000, 0.00000000, 0.24705882},
}
Grey = Colour{
Name: "Grey",
RGB: [3]float64{0.50196078, 0.50196078, 0.50196078},
RGBui8: [3]uint8{128, 128, 128},
RGBui32: 0x808080,
XYZ: [3]float64{0.20516590, 0.21586050, 0.23501898},
Lab: [3]float64{53.58501344, -0.00147625, 0.00279193},
HSL: [3]float64{0.00000000, 0.00000000, 0.50196078},
CMY: [3]float64{0.49803922, 0.49803922, 0.49803922},
CMYK: [4]float64{0.00000000, 0.00000000, 0.00000000, 0.49803922},
}
Maroon = Colour{
Name: "Maroon",
RGB: [3]float64{0.50196078, 0.00000000, 0.00000000},
RGBui8: [3]uint8{128, 0, 0},
RGBui32: 0x800000,
XYZ: [3]float64{0.08903231, 0.04590727, 0.00417345},
Lab: [3]float64{25.53540775, 48.04503468, 38.05710150},
HSL: [3]float64{0.00000000, 1.00000000, 0.25098039},
CMY: [3]float64{0.49803922, 1.00000000, 1.00000000},
CMYK: [4]float64{0.00000000, 1.00000000, 1.00000000, 0.49803922},
}
Olive = Colour{
Name: "Olive",
RGB: [3]float64{0.50196078, 0.50196078, 0.00000000},
RGBui8: [3]uint8{128, 128, 0},
RGBui32: 0x808000,
XYZ: [3]float64{0.16621971, 0.20028206, 0.02990251},
Lab: [3]float64{51.86908682, -12.93002122, 56.67466492},
HSL: [3]float64{0.166666667, 1.00000000, 0.25098039},
CMY: [3]float64{0.49803922, 0.49803922, 1.00000000},
CMYK: [4]float64{0.00000000, 0.00000000, 1.00000000, 0.49803922},
}
Green = Colour{
Name: "Green",
RGB: [3]float64{0.00000000, 0.50196078, 0.00000000},
RGBui8: [3]uint8{0, 128, 0},
RGBui32: 0x008000,
XYZ: [3]float64{0.07718740, 0.15437479, 0.02572906},
Lab: [3]float64{46.22765699, -51.69867822, 49.89707478},
HSL: [3]float64{0.333333333, 1.00000000, 0.25098039},
CMY: [3]float64{1.00000000, 0.49803922, 1.00000000},
CMYK: [4]float64{1.00000000, 0.00000000, 1.00000000, 0.49803922},
}
Purple = Colour{
Name: "Purple",
RGB: [3]float64{0.50196078, 0.00000000, 0.50196078},
RGBui8: [3]uint8{128, 0, 128},
RGBui32: 0x800080,
XYZ: [3]float64{0.12797851, 0.06148570, 0.20928992},
Lab: [3]float64{29.78424214, 58.92714644, -36.48475306},
HSL: [3]float64{0.833333333, 1.00000000, 0.25098039},
CMY: [3]float64{0.49803922, 1.00000000, 0.49803922},
CMYK: [4]float64{0.00000000, 1.00000000, 0.00000000, 0.49803922},
}
Teal = Colour{
Name: "Teal",
RGB: [3]float64{0.00000000, 0.50196078, 0.50196078},
RGBui8: [3]uint8{0, 128, 128},
RGBui32: 0x008080,
XYZ: [3]float64{0.11613359, 0.16995323, 0.23084553},
Lab: [3]float64{48.25414221, -28.84814851, -8.47397218},
HSL: [3]float64{0.50000000, 1.00000000, 0.25098039},
CMY: [3]float64{1.00000000, 0.49803922, 0.49803922},
CMYK: [4]float64{1.00000000, 0.00000000, 0.00000000, 0.49803922},
}
Navy = Colour{
Name: "Navy",
RGB: [3]float64{0.00000000, 0.00000000, 0.50196078},
RGBui8: [3]uint8{0, 0, 128},
RGBui32: 0x000080,
XYZ: [3]float64{0.03894620, 0.01557844, 0.20511647},
Lab: [3]float64{12.97116622, 47.50111614, -64.70044074},
HSL: [3]float64{0.666666667, 1.00000000, 0.25098039},
CMY: [3]float64{1.00000000, 1.00000000, 0.49803922},
CMYK: [4]float64{1.00000000, 1.00000000, 0.00000000, 0.49803922},
}
BasicColours = []Colour{
Black,
White,
Red,
Lime,
Blue,
Yellow,
Cyan,
Magenta,
Silver,
Grey,
Maroon,
Olive,
Green,
Purple,
Teal,
Navy,
}
AllColours = BasicColours
)