<p></p>
<p><b>@hlfan</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5396#discussion_r1882932337">vendor/assets/leaflet/leaflet.osm.js</a>:</p>
<pre style='color:#555'>>      options = L.Util.setOptions(this, options);
-    L.TileLayer.prototype.initialize.call(this, options.url);
+    url = isDarkMap ? options.darkUrl : options.lightUrl;
</pre>
<p dir="auto">Well, if the provided layers can be expected always to be a light-mode-first choice, the logic can be simplified to this more unreadable version:</p>
<div class="highlight highlight-source-js" dir="auto"><pre class="notranslate">    <span class="pl-s1">options</span><span class="pl-kos">.</span><span class="pl-c1">filter</span> <span class="pl-c1">=</span> <span class="pl-s1">isDarkMap</span> <span class="pl-c1">&&</span> <span class="pl-s1">options</span><span class="pl-kos">.</span><span class="pl-c1">darkFilter</span> <span class="pl-c1">||</span> <span class="pl-s">'none'</span><span class="pl-kos">;</span>
    <span class="pl-s1">options</span> <span class="pl-c1">=</span> <span class="pl-v">L</span><span class="pl-kos">.</span><span class="pl-c1">Util</span><span class="pl-kos">.</span><span class="pl-en">setOptions</span><span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">,</span> <span class="pl-s1">options</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-s1">url</span> <span class="pl-c1">=</span> <span class="pl-s1">isDarkMap</span> <span class="pl-c1">&&</span> <span class="pl-s1">options</span><span class="pl-kos">.</span><span class="pl-c1">darkUrl</span><span class="pl-kos">;</span>
    <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">schemeClass</span> <span class="pl-c1">=</span> <span class="pl-s1">url</span> <span class="pl-c1">&&</span> <span class="pl-s">'dark'</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">But I thought an implementation agnostic to that would be easier to think through with more options for cartographers' choices.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5396#discussion_r1882932337">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLN7JQN6THTGPDA35W32FIABDAVCNFSM6AAAAABTQPSKUSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKMBQHA2DIMBTG4">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLLUNRFDQX6R4IMOYLT2FIABDA5CNFSM6AAAAABTQPSKUSWGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTUVB7NAK.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5396/review/2500844037</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/5396#discussion_r1882932337",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5396#discussion_r1882932337",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>