Browse Source

car_maxspeed: Improvements: better colors, map key

fossil
parent
commit
9895cd6300
  1. 61
      car_maxspeed.json

61
car_maxspeed.json

@ -36,19 +36,76 @@
"{% if not maxspeedKmh %}", "{% if not maxspeedKmh %}",
"{% set color = \"#404040\" %}", "{% set color = \"#404040\" %}",
"{% else %}", "{% else %}",
"{% set color = colorInterpolate([ 'green', 'orange', 'red' ], maxspeedKmh / 150) %}",
"{% set color = colorInterpolate(const.colorMap, (maxspeedKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}",
"{% endif %}" "{% endif %}"
], ],
"description": [ "description": [
"{% if maxspeed %}", "{% if maxspeed %}",
"<span style='color: {{ color }}'>{{ maxspeed }} {{ unit }}</span>", "<span style='color: {{ color }}'>{{ maxspeed }} {{ unit }}</span>",
"{% elseif tags.maxspeed %}",
"{{ tags.maxspeed }}",
"{% else %}", "{% else %}",
"{{ trans('unknown') }}", "{{ trans('unknown') }}",
"{% endif %}" "{% endif %}"
], ],
"markerSign": null, "markerSign": null,
"listMarkerSymbol": "line",
"style": { "style": {
"weight": "3",
"color": "{{ color }}" "color": "{{ color }}"
} }
}
},
"const": {
"colorMap": [
"#00af00",
"#ff7f00",
"#ff0000",
"#af00af"
],
"highestColorSpeed": 150,
"offsetColorSpeed": 10
},
"info": [
"<div style='display: inline-block'>",
"<table>",
" <tr>",
" <td>{{ markerLine(evaluate({}))|raw }}</td>",
" <td colspan>{{ trans('unknown') }}</td>",
" </tr>",
"{% for i in range(10, 140, 20) %}",
" <tr>",
" <td>{{ markerLine(evaluate({ \"maxspeed\": i }))|raw }}</td>",
" <td>{{ i }}km/h</td>",
" </tr>",
"{% endfor %}",
" <tr>",
" <td>{{ markerLine(evaluate({ \"maxspeed\": 150 }))|raw }}</td>",
" <td>≥150km/h</td>",
" </tr>",
"</table>",
"</div>",
"",
"<div style='display: inline-block'>",
"<table>",
" <tr>",
" <td>{{ markerLine(evaluate({}))|raw }}</td>",
" <td colspan>{{ trans('unknown') }}</td>",
" </tr>",
"{% for i in range(10, 60, 10) %}",
" <tr>",
" <td>{{ markerLine(evaluate({ \"maxspeed\": (i * 1.60934)|round }))|raw }}</td>",
" <td>{{ i }}mph</td>",
" </tr>",
"{% endfor %}",
" <tr>",
" <td>{{ markerLine(evaluate({ \"maxspeed\": (75 * 1.60934)|round }))|raw }}</td>",
" <td>75mph</td>",
" </tr>",
" <tr>",
" <td>{{ markerLine(evaluate({ \"maxspeed\": (95 * 1.60934)|round }))|raw }}</td>",
" <td>≥95mph</td>",
" </tr>",
"</table>",
"</div>"
]
} }
Loading…
Cancel
Save