This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How to style roads? Having trouble with road-colors.yaml

0

I am using the basic openstreetmap-carto styling for my map. I am trying to re-color the roads so that all roads are white.

To make this change, I came across the file named road-colors.yaml.

The color syntax is nothing I have seen before. I found no instructions online as to how I can edit this file.

I simply want all roads to be white. How do I do that?

Default file contents:

# This is the input for scripts/generate_road_colours.py

# All road classes colours will be generated for, in order of importance
# (biggest first).
roads:
  - motorway
  - trunk
  - primary
  - secondary

# The starting and ending hue. The range goes from 0 to 360, with 0 and 360
# representing red.
hue: [10, 106]

# The lightness and chroma (also known as saturation) for each type of colour.
# Lightness ranges from 0 to 100; dark to bright.
# Chroma ranges from 0 to 100 too; unsaturated to fully saturated.
classes:
  # Colours for output into the MSS file
  mss:
    fill:
      lightness: [70, 97]
      chroma: [35, 29]
    casing:
      lightness: [50, 50]
      chroma: [70, 55]
    low-zoom:
      lightness: [62, 92]
      chroma: [50, 40]
    low-zoom-casing:
      lightness: [50, 70]
      chroma: [50, 65]
    shield:
      lightness: [20, 25]
      chroma: [40, 42]
  # Colours used by the road shields script
  shield:
    fill:
      lightness: [85, 95]
      chroma: [12, 14]
    stroke_fill:
      lightness: [70, 80]
      chroma: [22, 24]

asked 04 Mar '19, 02:05

valachio's gravatar image

valachio
418913
accept rate: 0%


2 Answers:

0

You can always override colors in style.mms. Just copy the bunch of definitions you want to modify, change the colors and voilà!

answered 15 Mar '21, 20:39

Marcos%20Dione's gravatar image

Marcos Dione
71113
accept rate: 0%

0

I know it's not preferable way by documentation but in my case I changed color hash codes in style/road-colors-generated.mss and during later updates it works fine. It's about colours of road. But not all 'line items' definitions you can find there. There is also file style/roads.mss where rest of colours are defined for that group (i.e. living-street, residential, footway, taxiway, railway etc.). Here you can customize every tag by ZOOM level including road width and object casing.

What (I think) is worth to be mentioned is that road definition is divided into 2 parts. One part is responsible for road itself (colour, width, casing), and in the same file but in lated parts you can find definition how street names are generated (font colour, spacing between next labels, linings etc.). The same file structure is in style/amenity-points.mss

I think it might be valuable knowledge especially for beginnners. It wasn't so clear for me couple days ago when I started to customize my own style.

answered 22 Mar '21, 08:27

engopy's gravatar image

engopy
126101015
accept rate: 0%

edited 22 Mar '21, 08:27

Source code available on GitHub .