-
Notifications
You must be signed in to change notification settings - Fork 4
/
color_defs.py
executable file
·58 lines (52 loc) · 1.87 KB
/
color_defs.py
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
'''
Define own colormaps.
'''
import matplotlib.colors as colors
#*********************************************************************************
def rgb_to_hex(rgb):
return '#%02x%02x%02x' % rgb
#*********************************************************************************
def custom(name):
if name == 'BlueRed':
var = colors.LinearSegmentedColormap.from_list(name,[\
rgb_to_hex(( 25, 25, 112)),\
rgb_to_hex(( 10, 50, 120)),\
rgb_to_hex((15, 75, 165)),\
rgb_to_hex((60, 160, 240)),\
rgb_to_hex((80, 180, 250)),\
rgb_to_hex((130, 210, 255)),\
rgb_to_hex((160, 225, 255)),\
rgb_to_hex((255, 255, 255)),\
rgb_to_hex((255, 255, 255)),\
rgb_to_hex((255, 232, 90)),\
rgb_to_hex((255, 160, 0)),\
rgb_to_hex((255, 96, 0)),\
rgb_to_hex((255, 50, 0)),\
rgb_to_hex((192, 0, 0)),\
rgb_to_hex((165, 0, 0)),\
rgb_to_hex((128, 0, 0))])
return var
elif name == 'BrownGreen':
var = colors.LinearSegmentedColormap.from_list(name,[\
rgb_to_hex((127, 39, 4)),\
rgb_to_hex((166, 54, 3)),\
rgb_to_hex((217, 72, 1)),\
rgb_to_hex((241, 105, 19)),\
rgb_to_hex((253, 141, 60)),\
rgb_to_hex((253, 174, 107)),\
rgb_to_hex((253, 208, 162)),\
rgb_to_hex((254, 230, 206)),\
rgb_to_hex((255, 255, 255)),\
rgb_to_hex((255, 255, 255)),\
rgb_to_hex((229, 245, 224)),\
rgb_to_hex((199, 233, 192)),\
rgb_to_hex((161, 217, 155)),\
rgb_to_hex((116, 196, 118)),\
rgb_to_hex((65, 171, 93)),\
rgb_to_hex((35, 139, 69)),\
rgb_to_hex((0, 109, 44)),\
rgb_to_hex((0, 68, 27))])
return var
#********************************************************************************************************
# END
#********************************************************************************************************