From 224c760480ccbbcaa5450299241301d03e683472 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sat, 4 Sep 2021 13:05:00 +0300 Subject: [PATCH] Patch osm-carto styles to be brighter and less RED --- Dockerfile | 3 + roads.diff | 111 +++++++++++++++++++++++++++++++++ style.diff | 179 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 293 insertions(+) create mode 100644 roads.diff create mode 100644 style.diff diff --git a/Dockerfile b/Dockerfile index 6fb7642..2e3ed58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -152,6 +152,9 @@ RUN mkdir -p /home/renderer/src \ COPY ./external-data.yml.diff /home/renderer/src/openstreetmap-carto RUN cd /home/renderer/src/openstreetmap-carto && patch -p1 < external-data.yml.diff +COPY ./style.diff /home/renderer/src/openstreetmap-carto +RUN cd /home/renderer/src/openstreetmap-carto && patch -p1 < style.diff + # Start running COPY run.sh / ENTRYPOINT ["/run.sh"] diff --git a/roads.diff b/roads.diff new file mode 100644 index 0000000..66203b1 --- /dev/null +++ b/roads.diff @@ -0,0 +1,111 @@ +diff --git a/road-colors.yaml b/road-colors.yaml +index 78d3188..855b9bb 100644 +--- a/road-colors.yaml ++++ b/road-colors.yaml +@@ -10,7 +10,7 @@ roads: + + # The starting and ending hue. The range goes from 0 to 360, with 0 and 360 + # representing red. +-hue: [10, 106] ++hue: [37, 53] + + # The lightness and chroma (also known as saturation) for each type of colour. + # Lightness ranges from 0 to 100; dark to bright. +@@ -19,20 +19,20 @@ classes: + # Colours for output into the MSS file + mss: + fill: +- lightness: [70, 97] +- chroma: [35, 29] ++ lightness: [1, 1] ++ chroma: [0.55, 0.35] + casing: +- lightness: [50, 50] +- chroma: [70, 55] ++ lightness: [0.8, 0.6] ++ chroma: [0.85, 1] + low-zoom: +- lightness: [62, 92] +- chroma: [50, 40] ++ lightness: [1, 1] ++ chroma: [0.55, 0.35] + low-zoom-casing: +- lightness: [50, 70] +- chroma: [50, 65] ++ lightness: [0.8, 0.6] ++ chroma: [0.85, 1] + shield: +- lightness: [20, 25] +- chroma: [40, 42] ++ lightness: [0.35, 0.25] ++ chroma: [1, 1] + # Colours used by the road shields script + shield: + fill: +diff --git a/scripts/generate_road_colours.py b/scripts/generate_road_colours.py +index e8672ff..76e84ea 100755 +--- a/scripts/generate_road_colours.py ++++ b/scripts/generate_road_colours.py +@@ -3,7 +3,7 @@ + # Generates a set of highway colors to be stored in road-colors-generated.mss. + + from colormath.color_conversions import convert_color +-from colormath.color_objects import LabColor, LCHabColor, sRGBColor ++from colormath.color_objects import LabColor, LCHabColor, sRGBColor, HSVColor + from colormath.color_diff import delta_e_cie2000 + import argparse + import sys +@@ -12,22 +12,22 @@ import yaml + from collections import OrderedDict, namedtuple + + class Color: +- """A color in the CIE lch color space.""" ++ """A color in the HSV color space.""" + +- def __init__(self, lch_tuple): +- self.m_lch = LCHabColor(*lch_tuple) ++ def __init__(self, hsv_tuple): ++ self.m_hsv = HSVColor(*hsv_tuple) + +- def lch(self): +- return "Lch({:.0f},{:.0f},{:.0f})".format(*(self.m_lch.get_value_tuple())) ++ def hsv(self): ++ return "Hsv({:.0f},{:.0f},{:.0f})".format(*(self.m_hsv.get_value_tuple())) + + def rgb(self): +- rgb = convert_color(self.m_lch, sRGBColor) +- if (rgb.rgb_r != rgb.clamped_rgb_r or rgb.rgb_g != rgb.clamped_rgb_g or rgb.rgb_b != rgb.clamped_rgb_b): +- raise Exception("Colour {} is outside sRGB".format(self.lch())) ++ rgb = convert_color(self.m_hsv, sRGBColor) ++ #if (rgb.rgb_r != rgb.clamped_rgb_r or rgb.rgb_g != rgb.clamped_rgb_g or rgb.rgb_b != rgb.clamped_rgb_b): ++ # raise Exception("Colour {} is outside sRGB".format(self.hsv())) + return rgb.get_rgb_hex() + + def rgb_error(self): +- return delta_e_cie2000(convert_color(self.m_lch, LabColor), ++ return delta_e_cie2000(convert_color(self.m_hsv, LabColor), + convert_color(sRGBColor.new_from_rgb_hex(self.rgb()), LabColor)) + + def load_settings(): +@@ -85,7 +85,7 @@ def generate_colours(settings, section): + + colours[line_name] = OrderedDict() + for name in road_classes: +- colours[line_name][name] = Color((l, c, hues[name])) ++ colours[line_name][name] = Color((hues[name], c, l)) + c += delta_c + l += delta_l + +@@ -112,10 +112,10 @@ def main(): + for line_name, line_colours in colours.items(): + for name, colour in line_colours.items(): + if args.verbose: +- line = "@{name}-{line_name}: {rgb}; // {lch}, error {delta:.1f}" ++ line = "@{name}-{line_name}: {rgb}; // {hsv}, error {delta:.1f}" + else: + line = "@{name}-{line_name}: {rgb};" +- print((line.format(name = name, line_name=line_name, rgb = colour.rgb(), lch = colour.lch(), delta = colour.rgb_error()))) ++ print((line.format(name = name, line_name=line_name, rgb = colour.rgb(), hsv = colour.hsv(), delta = colour.rgb_error()))) + + if __name__ == "__main__": + main() diff --git a/style.diff b/style.diff new file mode 100644 index 0000000..56d22a8 --- /dev/null +++ b/style.diff @@ -0,0 +1,179 @@ +diff --git a/style/buildings.mss b/style/buildings.mss +index 6b1b0bb..67ad9c1 100644 +--- a/style/buildings.mss ++++ b/style/buildings.mss +@@ -1,4 +1,4 @@ +-@building-fill: #d9d0c9; // Lch(84, 5, 68) ++@building-fill: #f1ede8; // Lch(84, 5, 68) + @building-line: darken(@building-fill, 15%); // Lch(70, 9, 66) + @building-low-zoom: darken(@building-fill, 4%); + +diff --git a/style/landcover.mss b/style/landcover.mss +index e85f9c0..1f554d9 100644 +--- a/style/landcover.mss ++++ b/style/landcover.mss +@@ -2,29 +2,29 @@ + + @grass: #cdebb0; // Lch(90,32,128) also grassland, meadow, village_green, garden, allotments + @scrub: #c8d7ab; // Lch(84,24,122) +-@forest: #add19e; // Lch(80,30,135) ++@forest: #d5f1bc; + @forest-text: #46673b; // Lch(40,30,135) +-@park: #c8facc; // Lch(94,30,145) ++@park: lighten(#d5f1bc, 5%); + @allotments: #c9e1bf; // Lch(87,20,135) + @orchard: #aedfa3; // also vineyard, plant_nursery + @hedge: @forest; // Lch(80,30,135) + + // --- "Base" landuses --- + +-@built-up-lowzoom: #d0d0d0; +-@built-up-z12: #dddddd; +-@residential: #e0dfdf; // Lch(89,0,0) +-@residential-line: #b9b9b9; // Lch(75,0,0) +-@retail: #ffd6d1; // Lch(89,16,30) +-@retail-line: #d99c95; // Lch(70,25,30) +-@commercial: #f2dad9; // Lch(89,8.5,25) +-@commercial-line: #d1b2b0; // Lch(75,12,25) +-@industrial: #ebdbe8; // Lch(89,9,330) (Also used for railway, wastewater_plant) +-@industrial-line: #c6b3c3; // Lch(75,11,330) (Also used for railway-line, wastewater_plant-line) +-@farmland: #eef0d5; // Lch(94,14,112) +-@farmland-line: #c7c9ae; // Lch(80,14,112) +-@farmyard: #f5dcba; // Lch(89,20,80) +-@farmyard-line: #d1b48c; // Lch(75,25,80) ++@built-up-lowzoom: #faf7f0; ++@built-up-z12: #faf7f0; ++@residential: #fcfcf7; ++@residential-line: darken(@residential, 15%); ++@retail: #faf5eb; ++@retail-line: darken(@retail, 15%); ++@commercial: #faf5eb; ++@commercial-line: darken(@commercial, 15%); ++@industrial: #ededf3; // (Also used for railway, wastewater_plant) ++@industrial-line: darken(@industrial, 15%); ++@farmland: #eef0d5; ++@farmland-line: darken(@farmland, 15%); ++@farmyard: #f5dcba; ++@farmyard-line: darken(@farmyard, 15%); + + // --- Transport ---- + +@@ -41,8 +41,8 @@ + + @bare_ground: #eee5dc; + @campsite: #def6c0; // also caravan_site, picnic_site +-@cemetery: #aacbaf; // also grave_yard +-@construction: #c7c7b4; // also brownfield ++@cemetery: #e5f1dc; // also grave_yard ++@construction: #e6e6e4; // also brownfield + @heath: #d6d99f; + @mud: rgba(203,177,154,0.3); // produces #e6dcd1 over @land + @place_of_worship: #d0d0d0; // also landuse_religious +diff --git a/style/placenames.mss b/style/placenames.mss +index 38a7232..988c170 100644 +--- a/style/placenames.mss ++++ b/style/placenames.mss +@@ -1,8 +1,8 @@ + @placenames: #222; + @placenames-light: #777777; +-@country-labels: darken(@admin-boundaries-narrow, 10%); +-@state-labels: desaturate(@admin-boundaries-narrow, 5%); +-@county-labels: darken(@admin-boundaries-wide, 5%); ++@country-labels: #606060; ++@state-labels: #686868; ++@county-labels: #707070; + + #country-names { + [zoom >= 3][zoom < 5][way_pixels > 1000], +diff --git a/style/road-colors-generated.mss b/style/road-colors-generated.mss +index 488d707..27e8694 100644 +--- a/style/road-colors-generated.mss ++++ b/style/road-colors-generated.mss +@@ -4,23 +4,23 @@ + /* */ + /* scripts/generate_road_colours.py > style/road-colors-generated.mss */ + /* */ +-@motorway-casing: #dc2a67; +-@trunk-casing: #c84e2f; +-@primary-casing: #a06b00; +-@secondary-casing: #707d05; +-@motorway-fill: #e892a2; +-@trunk-fill: #f9b29c; +-@primary-fill: #fcd6a4; +-@secondary-fill: #f7fabf; +-@motorway-low-zoom: #e66e89; +-@trunk-low-zoom: #f6967a; +-@primary-low-zoom: #f4c37d; +-@secondary-low-zoom: #e7ed9d; +-@motorway-low-zoom-casing: #c24e6b; +-@trunk-low-zoom-casing: #d1684a; +-@primary-low-zoom-casing: #c78d2b; +-@secondary-low-zoom-casing: #a4b329; +-@motorway-shield: #620728; +-@trunk-shield: #5f1c0c; +-@primary-shield: #503000; +-@secondary-shield: #364000; ++@motorway-casing: #cc671f; ++@trunk-casing: #bb6c13; ++@primary-casing: #aa7008; ++@secondary-casing: #997300; ++@motorway-fill: #ffad73; ++@trunk-fill: #ffc584; ++@primary-fill: #ffd995; ++@secondary-fill: #ffe9a6; ++@motorway-low-zoom: #ffad73; ++@trunk-low-zoom: #ffc584; ++@primary-low-zoom: #ffd995; ++@secondary-low-zoom: #ffe9a6; ++@motorway-low-zoom-casing: #cc671f; ++@trunk-low-zoom-casing: #bb6c13; ++@primary-low-zoom-casing: #aa7008; ++@secondary-low-zoom-casing: #997300; ++@motorway-shield: #592500; ++@trunk-shield: #512b00; ++@primary-shield: #482e00; ++@secondary-shield: #403000; +diff --git a/style/roads.mss b/style/roads.mss +index c750ba2..f07758f 100644 +--- a/style/roads.mss ++++ b/style/roads.mss +@@ -2080,7 +2080,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ + [feature = 'railway_rail'][zoom >= 8], + [feature = 'railway_INT-spur-siding-yard'][zoom >= 13] { + [zoom < 13] { +- line-color: #787878; ++ line-color: #b0b0b0; + line-width: 0.5; + [zoom >= 8] { line-width: 0.8; } + [zoom >= 12] { line-width: 0.9; } +@@ -2095,7 +2095,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ + light/line-color: white; + light/line-join: round; + [feature = 'railway_rail'] { +- dark/line-color: #707070; ++ dark/line-color: #b0b0b0; + dark/line-width: 2; + light/line-width: 0.75; + light/line-dasharray: 8,8; +@@ -2123,7 +2123,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ + } + } + #tunnels { +- line-color: #787878; ++ line-color: #c0c0c0; + line-width: 2.8; + line-dasharray: 6,4; + line-clip: false; +diff --git a/style/style.mss b/style/style.mss +index 6bb5b6a..7c78823 100644 +--- a/style/style.mss ++++ b/style/style.mss +@@ -2,7 +2,7 @@ Map { + background-color: @land-color; + } + +-@water-color: #aad3df; ++@water-color: #b8dff5; + @land-color: #f2efe9; + + @standard-halo-radius: 1;