From 0bb2d62e108898a6c188655c0df90b9bd67ad76b Mon Sep 17 00:00:00 2001 From: Will Ginsberg Date: Tue, 7 May 2024 11:35:34 -0500 Subject: [PATCH] use "light" as a fallback when no theme is provided to leafletLayer() --- src/frontends/leaflet.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/frontends/leaflet.ts b/src/frontends/leaflet.ts index 46dafbfc..3c6712dc 100644 --- a/src/frontends/leaflet.ts +++ b/src/frontends/leaflet.ts @@ -74,16 +74,13 @@ const leafletLayer = (options: LeafletLayerOptions = {}): unknown => { 'Protomaps © OpenStreetMap'; super(options); - if (options.theme) { - const theme = themes[options.theme]; - this.paintRules = paintRules(theme); - this.labelRules = labelRules(theme); - this.backgroundColor = theme.background; - } else { - this.paintRules = options.paintRules || []; - this.labelRules = options.labelRules || []; - this.backgroundColor = options.backgroundColor; - } + const theme = options.theme + ? themes[options.theme] + : themes.light; + + this.paintRules = options.paintRules || paintRules(theme); + this.labelRules = options.labelRules || labelRules(theme); + this.backgroundColor = options.backgroundColor || theme.background; this.lastRequestedZ = undefined; this.tasks = options.tasks || [];