TransWikia.com

CartoCSS & change colours on road-colors.yaml

Geographic Information Systems Asked on August 3, 2021

I am looking at just having one shading of colours for OSM roads like red. When I update the hue values to something like 10-45. I try the generate the generate_road_colours.mss file. But this usually fails with the one of the values being outside the sRGB.

I have tried changing the lightness and chroma, but I am having no joy, can anyone help?

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, 40]

# 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: [80, 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]

One Answer

The issue is the lightness is making the red become out of the RGB range, in the fill values.

hue: [0, 45]

classes: mss: fill: lightness: [62, 75] chroma: [35, 29] casing: lightness: [50, 50] chroma: [70, 55] low-zoom: lightness: [57, 70] chroma: [55, 45] low-zoom-casing: lightness: [50, 70] chroma: [50, 65] shield: lightness: [20, 25] chroma: [40, 42] shield: fill: lightness: [74, 85] chroma: [22, 24] stroke_fill: lightness: [60, 70] chroma: [27, 30]

Answered by Jon McCloskey on August 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP