From 85025f23b1470800bc6ff1ba576f8d5a7a1ccbb9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= <skunk@xover.mud.at>
Date: Tue, 1 Oct 2024 20:03:40 +0200
Subject: [PATCH] railway-rails: restructure const

---
 railway-rails.yaml | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/railway-rails.yaml b/railway-rails.yaml
index 4b02b51..2b788e0 100644
--- a/railway-rails.yaml
+++ b/railway-rails.yaml
@@ -11,7 +11,7 @@ feature:
       {% set type = attribute(tags, tags.railway)|default(attribute(tags, tags.railway ~ ':railway')) %}
     {% endif %}
 
-    {% set color = const.color[type ~ '/' ~ tags.usage]|default(const.color[type])|default(const.color.default) %}
+    {% set color = const.types[type ~ '/' ~ tags.usage].color|default(const.types[type].color)|default(const.types.default.color) %}
 
     {% if tags.tunnel and tags.tunnel != 'no' %}
       {% set color = colorInterpolate([ color, '#ffffff' ], 0.3) %}
@@ -61,7 +61,7 @@ feature:
   listMarkerSymbol: line
   styles: |-
     {% if tags.bridge and tags.bridge != 'no' %}casing_bridge,{% endif %}
-    {% if const.color[tags.railway] %}casing,casing_layer,{% endif %}
+    {% if const.types[tags.railway] %}casing,casing_layer,{% endif %}
     {% if tags.railway in ['abandoned', 'disused', 'razed'] %}disused,{% endif %}
     {% if tags.railway == 'narrow_gauge' %}default,narrow
     {% else %}default
@@ -151,14 +151,25 @@ info: |-
   {% endif %}
   </table>
 const:
-  color:
-    rail: '#000000'
-    rail/main: '#ff8100'
-    rail/branch: '#daca00'
-    narrow_gauge: '#000000'
-    subway: '#0000ff'
-    tram: '#ff00ff'
-    light_rail: '#ff007f'
-    funicular: '#00BD14'
-    monorail: '#007f00'
-    default: '#000000'
+  types:
+    rail:
+      color: '#000000'
+    rail/main:
+      color: '#ff8100'
+    rail/branch:
+      color: '#daca00'
+    narrow_gauge:
+      color: '#000000'
+    subway:
+      color: '#0000ff'
+    tram:
+      color: '#ff00ff'
+    light_rail:
+      color: '#ff007f'
+    funicular:
+      color: '#00BD14'
+    monorail:
+      color: '#007f00'
+    default:
+      color: '#ff0000'
+      hide: true