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:
authorRokuz <r.kuznetsow@gmail.com>2017-11-21 17:52:41 +0300
committerDaria Volvenkova <d.volvenkova@corp.mail.ru>2017-11-22 11:53:38 +0300
commit1aaf9f4f8ccb80b0768db36c2af2e821442e5546 (patch)
tree90fd8e96fddaed48107fc83048efed208715058b
parenta2a40f21021e58b5cf50f82e6812a16d5b353189 (diff)
Added exporting of transits colors to colors.txt
-rw-r--r--data/transit_colors.txt112
-rw-r--r--tools/python/transit/transit_color_palette.py5
-rwxr-xr-xtools/python/transit/transit_colors_export.py34
-rwxr-xr-xtools/unix/generate_drules.sh4
4 files changed, 117 insertions, 38 deletions
diff --git a/data/transit_colors.txt b/data/transit_colors.txt
index 7f19557a9a..bcdfc0846e 100644
--- a/data/transit_colors.txt
+++ b/data/transit_colors.txt
@@ -3,172 +3,212 @@
"default": {
"clear": "231F20",
"night": "231F20",
- "text": "231F20"
+ "text": "231F20",
+ "text_night": "464647"
},
"gray": {
"clear": "A4A4A6",
"night": "464647",
- "text": "231F20"
+ "text": "231F20",
+ "text_night": "464647"
+ },
+ "brown_dark": {
+ "clear": "664433",
+ "night": "33221A",
+ "text": "3E2723",
+ "text_night": "5A4E48"
},
"brown": {
"clear": "9C491F",
"night": "4D210B",
- "text": "3E2723"
+ "text": "3E2723",
+ "text_night": "5A4E48"
},
"brown_light": {
"clear": "B39B8F",
"night": "5A4E48",
- "text": "3E2723"
+ "text": "3E2723",
+ "text_night": "5A4E48"
},
"red_dark": {
"clear": "7A1212",
"night": "3E0A0A",
- "text": "7A1212"
+ "text": "7A1212",
+ "text_night": "733A3A"
},
"red": {
"clear": "FA1E38",
"night": "800B19",
- "text": "7A1212"
+ "text": "7A1212",
+ "text_night": "733A3A"
},
"red_light": {
"clear": "E57373",
"night": "733A3A",
- "text": "7A1212"
+ "text": "7A1212",
+ "text_night": "733A3A"
},
"orange": {
"clear": "FF5722",
"night": "802C12",
- "text": "E65100"
+ "text": "E65100",
+ "text_night": "804633"
},
"orange_light": {
"clear": "FF8A65",
"night": "804633",
- "text": "E65100"
+ "text": "E65100",
+ "text_night": "804633"
},
"amber_dark": {
"clear": "EF6C00",
"night": "703400",
- "text": "FF6F00"
+ "text": "FF6F00",
+ "text_night": "A98F67"
},
"amber": {
"clear": "FF9800",
"night": "804D00",
- "text": "FF6F00"
+ "text": "FF6F00",
+ "text_night": "A98F67"
},
"yellow_dark": {
- "clear": "E69B22",
- "night": "744E12",
- "text": "F57F17"
+ "clear": "CC953D",
+ "night": "664510",
+ "text": "F57F17",
+ "text_night": "B4AE7E"
},
"yellow": {
"clear": "FFCC09",
"night": "8F7F06",
- "text": "F57F17"
+ "text": "F57F17",
+ "text_night": "B4AE7E"
},
"lime_dark": {
"clear": "827717",
"night": "423C0C",
- "text": "827717"
+ "text": "827717",
+ "text_night": "5B6D36"
},
"lime": {
"clear": "33C73B",
"night": "34691B",
- "text": "827717"
+ "text": "827717",
+ "text_night": "5B6D36"
},
"lime_light": {
"clear": "B2D636",
"night": "4D661A",
- "text": "827717"
+ "text": "827717",
+ "text_night": "5B6D36"
},
"green_dark": {
"clear": "1B5E20",
"night": "0E3011",
- "text": "1B5E20"
+ "text": "1B5E20",
+ "text_night": "416443"
},
"green": {
"clear": "009A2C",
"night": "004D1A",
- "text": "1B5E20"
+ "text": "1B5E20",
+ "text_night": "416443"
},
"green_light": {
"clear": "81C784",
"night": "416443",
- "text": "1B5E20"
+ "text": "1B5E20",
+ "text_night": "416443"
},
"teal_dark": {
"clear": "00695C",
"night": "00352F",
- "text": "004D40"
+ "text": "004D40",
+ "text_night": "34524F"
},
"teal": {
"clear": "00BFA5",
"night": "005441",
- "text": "004D40"
+ "text": "004D40",
+ "text_night": "34524F"
},
"teal_light": {
"clear": "80CBC4",
"night": "34524F",
- "text": "004D40"
+ "text": "004D40",
+ "text_night": "34524F"
},
"blue_dark": {
"clear": "02729C",
"night": "023A4F",
- "text": "01579B"
+ "text": "01579B",
+ "text_night": "466178"
},
"blue": {
"clear": "03A9F4",
"night": "02557B",
- "text": "01579B"
+ "text": "01579B",
+ "text_night": "466178"
},
"blue_light": {
"clear": "B2D8F8",
"night": "466178",
- "text": "01579B"
+ "text": "01579B",
+ "text_night": "466178"
},
"navy_dark": {
"clear": "193380",
"night": "0F1B42",
- "text": "1A357D"
+ "text": "1A357D",
+ "text_night": "3D4866"
},
"navy": {
"clear": "243BB3",
"night": "003557",
- "text": "1A357D"
+ "text": "1A357D",
+ "text_night": "3D4866"
},
"navy_light": {
"clear": "7A96CC",
"night": "3D4866",
- "text": "1A357D"
+ "text": "1A357D",
+ "text_night": "3D4866"
},
"purple_dark": {
"clear": "52138B",
"night": "360E66",
- "text": "4A148C"
+ "text": "4A148C",
+ "text_night": "684A6D"
},
"purple": {
"clear": "BF00AF",
"night": "600058",
- "text": "4A148C"
+ "text": "4A148C",
+ "text_night": "684A6D"
},
"purple_light": {
"clear": "CE93D8",
"night": "684A6D",
- "text": "4A148C"
+ "text": "4A148C",
+ "text_night": "684A6D"
},
"pink_dark": {
"clear": "880E4F",
"night": "660A3B",
- "text": "880E4F"
+ "text": "880E4F",
+ "text_night": "7B4859"
},
"pink": {
"clear": "F50057",
"night": "7B002C",
- "text": "880E4F"
+ "text": "880E4F",
+ "text_night": "7B4859"
},
"pink_light": {
"clear": "F48FB1",
"night": "7B4859",
- "text": "880E4F"
+ "text": "880E4F",
+ "text_night": "7B4859"
}
}
}
diff --git a/tools/python/transit/transit_color_palette.py b/tools/python/transit/transit_color_palette.py
index df44ce69bf..29c4ba6657 100644
--- a/tools/python/transit/transit_color_palette.py
+++ b/tools/python/transit/transit_color_palette.py
@@ -112,8 +112,9 @@ class Palette:
bluish = is_bluish(color)
for name, palette_color in self.colors.iteritems():
- if name in excluded_names:
- continue
+ # Uncomment if you want to exclude duplicates.
+ #if name in excluded_names:
+ # continue
if bluish:
diff = lum_distance(palette_color, color)
else:
diff --git a/tools/python/transit/transit_colors_export.py b/tools/python/transit/transit_colors_export.py
new file mode 100755
index 0000000000..333cf28bd0
--- /dev/null
+++ b/tools/python/transit/transit_colors_export.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python2.7
+# It exports all transits colors to colors.txt file.
+import argparse
+import json
+import os.path
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ default_colors_path = os.path.dirname(os.path.abspath(__file__)) + '/../../../data/colors.txt'
+ parser.add_argument('in_out_file', nargs='?', type=str, default=default_colors_path,
+ help='path to colors.txt file')
+ default_transits_colors_path = os.path.dirname(os.path.abspath(__file__)) + '/../../../data/transit_colors.txt'
+ parser.add_argument('-c', '--colors', nargs='?', type=str, default=default_transits_colors_path,
+ help='path to transit_colors.txt file')
+
+ args = parser.parse_args()
+
+ colors = set()
+ with open(args.in_out_file, 'r') as in_file:
+ lines = in_file.readlines()
+ for l in lines:
+ colors.add(int(l))
+
+ fields = ['clear', 'night', 'text', 'text_night']
+ with open(args.colors, 'r') as colors_file:
+ tr_colors = json.load(colors_file)
+ for name, color_info in tr_colors['colors'].iteritems():
+ for field in fields:
+ if field in color_info:
+ colors.add(int(color_info[field], 16))
+
+ with open(args.in_out_file, 'w') as out_file:
+ for c in sorted(colors):
+ out_file.write(str(c) + os.linesep)
diff --git a/tools/unix/generate_drules.sh b/tools/unix/generate_drules.sh
index 766b524bdb..1ffd7ae13c 100755
--- a/tools/unix/generate_drules.sh
+++ b/tools/unix/generate_drules.sh
@@ -36,6 +36,10 @@ BuildDrawingRules vehicle night _vehicle_dark
# In designer mode we use drules_proto_design file instead of standard ones
cp $OMIM_PATH/data/drules_proto_clear.bin $OMIM_PATH/data/drules_proto_design.bin
+echo "Exporting transit colors"
+python "$OMIM_PATH/tools/python/transit/transit_colors_export.py" \
+ "$DATA_PATH/colors.txt" > /dev/null
+
echo "Merging default and vehicle styles"
python "$OMIM_PATH/tools/python/stylesheet/drules_merge.py" \
"$DATA_PATH/drules_proto_clear.bin" "$DATA_PATH/drules_proto_vehicle_clear.bin" \