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
|
0, 0, 0
215, 95, 0
175, 95, 0
255, 215, 95
0, 95, 95
255, 95, 135
255, 175, 0
238, 238, 238
128, 128, 128 // 8
215, 135, 0
175, 135, 0
255, 255, 95
0, 135, 95
255, 135, 135
255, 215, 0
255, 255, 255
def vec4_to_hex(colors):
for c in colors:
print('#%08x' % (
(round(c[0] * 255) << 24) & 0xFF000000|
(round(c[1] * 255) << 16) & 0x00FF0000|
(round(c[2] * 255) << 8 ) & 0x0000FF00|
(round(c[3] * 255 ) & 0x000000FF)))
def hex_to_vec4(colors):
for c in colors:
print('%d,%d,%d,%d' % (
(c >> 24 & 0xFF),
(c >> 16 & 0xFF),
(c >> 8 & 0xFF),
(c & 0xFF)))
def hex_to_vec3(colors):
for c in colors:
print('%d,%d,%d' % (
(c >> 16 & 0xFF),
(c >> 8 & 0xFF),
(c & 0xFF)))
|