Skip to content

Instantly share code, notes, and snippets.

View ericoc's full-sized avatar
💭
living @ 🌎

Eric O'Callaghan ericoc

💭
living @ 🌎
View GitHub Profile
@BrendonKoz
BrendonKoz / leaflet-darkmode.md
Last active August 18, 2025 13:28
Automatic Dark Mode for Leaflet.js
// Leaflet JS - note the *className* attribute
// [...]

L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
    className: 'map-tiles'
}).addTo(map);

// [...]