Skip to content

Conversation

@na9da
Copy link
Collaborator

@na9da na9da commented Nov 4, 2025

Split from #7626
Required for #6845

What this PR does

Adds backgroundColor trait to base maps for setting the background color of the Leaflet map container when the base map is selected.

Example config:

{
  "baseMaps": {
    "items": [
      {
        "item": {
          "id": "basemap-bing-aerial-with-labels"
        },
        "backgroundColor": "#00101d"
      },
      {
        "item": {
          "id": "basemap-bing-aerial"
        },
        "backgroundColor": "#00101d"
      },
      {
        "item": {
          "id": "basemap-bing-roads"
        },
        "backgroundColor": "#acc7f2"
      }
    ]
  }
}

Test me

  • Open this CI link which uses this catalog definition
  • Switch to 2D mode
  • Switch between the Bing base maps
  • Observe that the background color of the map container changes with the base map and is different to the default grey color

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated relevant documentation in doc/.
  • I've updated CHANGES.md with what I changed.
  • I've provided instructions in the PR description on how to test this PR.

Comment on lines +125 to +126
// object array trait doesn't automatically update model item
updateModelFromJson(existingItem, stratumId, items[i]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual (non-prettier) change is this line which updates all traits from the new definition instead of just the image trait.

Copy link
Contributor

@micholm micholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great feature :)

@na9da na9da merged commit 594e702 into main Nov 5, 2025
9 checks passed
@na9da na9da deleted the leaflet-background branch November 5, 2025 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants