forked from moroen/IKEA-Tradfri-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolors.py
70 lines (57 loc) · 2.02 KB
/
colors.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
59
60
61
62
63
64
65
66
67
68
69
70
COLORS = {
0: {"Name": "Off", "Hex": '000000'},
10: {"Name": "Blue", "Hex": '4a418a'},
20: {"Name": "Candlelight", "Hex": 'ebb63e'},
30: {"Name": "Cold sky", "Hex": 'dcf0f8'},
40: {"Name": "Cool daylight", "Hex": 'eaf6fb'},
50: {"Name": "Cool white", "Hex": 'f5faf6'},
60: {"Name": "Dark Peach", "Hex": 'da5d41'},
70: {"Name": "Light Blue", "Hex": '6c83ba'},
80: {"Name": "Light Pink", "Hex": 'e8bedd'},
90: {"Name": "Light Purple", "Hex": 'c984bb'},
100: {"Name": "Lime", "Hex": 'a9d62b'},
110: {"Name": "Peach", "Hex": 'e57345'},
120: {"Name": "Pink", "Hex": 'e491af'},
130: {"Name": "Saturated Red", "Hex": 'dc4b31'},
140: {"Name": "Saturated Pink", "Hex": 'd9337c'},
150: {"Name": "Saturated Purple", "Hex": '8f2686'},
160: {"Name": "Sunrise", "Hex": 'f2eccf'},
170: {"Name": "Yellow", "Hex": 'd6e44b'},
180: {"Name": "Warm Amber", "Hex": 'e78834'},
190: {"Name": "Warm glow", "Hex": 'efd275'},
200: {"Name": "Warm white", "Hex": 'f1e0b5'}
}
WB = {
0: {"Name": "Off", "Hex": '000000'},
10: {"Name": "Cold", "Hex": 'f5faf6'},
20: {"Name": "Normal", "Hex": 'f1e0b5'},
30: {"Name": "Warm", "Hex": 'efd275'}
}
TEST = { "a":"Test", "b":"Test"}
d = {'x': 1, 'y': 2, 'z': 3}
def color(level):
return COLORS[level]
def wb(level):
return WB[level]
def colorLevelDefinitions():
levels=""
actions=""
for key, aColor in sorted(COLORS.items()):
levels="{0}{1}|".format(levels, aColor["Name"])
actions="{0}{1}|".format(actions, "")
return levels[:-1], actions[:-1]
def colorLevelForHex(hex):
for key in COLORS:
if COLORS[key]["Hex"] == hex:
return key
def wbLevelForHex(hex):
for key in WB:
if WB[key]["Hex"] == hex:
return key
def wbLevelDefinitions():
levels=""
actions=""
for key, aColor in sorted(WB.items()):
levels="{0}{1}|".format(levels, aColor["Name"])
actions="{0}{1}|".format(actions, "")
return levels[:-1], actions[:-1]