Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaria Volvenkova <d.volvenkova@corp.mail.ru>2017-10-26 17:41:02 +0300
committerIlya Zverev <ilya@zverev.info>2017-11-02 15:24:08 +0300
commitb3dcf878e3bd95c13dc808e9200aa33a0f702eee (patch)
treeabc041925aa9ac17dd44515c06164b518daecbf5 /tools/python/transit/transit_color_palette.py
parent1fd010804342d63618c741d1d7b0e42c3886b835 (diff)
Transit colours updated, added line interval and stop time processing.
Diffstat (limited to 'tools/python/transit/transit_color_palette.py')
-rw-r--r--tools/python/transit/transit_color_palette.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/tools/python/transit/transit_color_palette.py b/tools/python/transit/transit_color_palette.py
index a107a064c4..a395e51f75 100644
--- a/tools/python/transit/transit_color_palette.py
+++ b/tools/python/transit/transit_color_palette.py
@@ -7,18 +7,17 @@ def to_rgb(color_str):
return (r, g, b)
-def to_rgba(rgb):
- return rgb[0] << 24 | rgb[1] << 16 | rgb[2] << 8 | 255
-
-
class Palette:
def __init__(self, colors):
self.colors = []
for color in colors['colors']:
- color_info = {'clear': to_rgb(color['clear']),
- 'night': to_rgb(color['night'])}
+ color_info = {'name': color['name'],
+ 'clear': to_rgb(color['clear'])}
self.colors.append(color_info)
+ def get_default_color(self):
+ return self.colors[0]['name']
+
def get_nearest_color(self, color_str):
"""Returns the nearest color from the palette."""
nearest_color_info = None
@@ -32,5 +31,4 @@ class Palette:
if min_diff is None or diff < min_diff:
min_diff = diff
nearest_color_info = color_info
- return {'clear': to_rgba(nearest_color_info['clear']),
- 'night': to_rgba(nearest_color_info['night'])}
+ return nearest_color_info['name']