Skip to content

Added the feature for custom backgrounds#11850

Open
JaiswalShivang wants to merge 2 commits intoopenstreetmap:developfrom
JaiswalShivang:feature/add-custom-background
Open

Added the feature for custom backgrounds#11850
JaiswalShivang wants to merge 2 commits intoopenstreetmap:developfrom
JaiswalShivang:feature/add-custom-background

Conversation

@JaiswalShivang
Copy link
Contributor

@JaiswalShivang JaiswalShivang commented Feb 5, 2026

feat: Multiple custom background layers with CRUD operations

Fixes #8874

Summary

This PR enables users to add, edit, name, and delete multiple custom background layers in the iD editor. Previously, only a single custom background was supported.

Demo Video

2026-02-05.22-21-29.mp4

Note: The video demonstrates adding, editing, naming, and deleting multiple custom backgrounds.

Changes

User-Facing Changes

  • Multiple Custom Backgrounds: Users can now add unlimited custom background layers
  • Dedicated Section: New "Custom Backgrounds" section in the Background pane
  • Named Backgrounds: Each custom background can have an optional name
  • URL Fallback: Backgrounds without names display a truncated URL (e.g., "Custom: tiles.example.com/berlin/…")
  • Add/Edit/Delete: Full CRUD operations with intuitive icons (pencil for edit, trash for delete)
  • Delete with Confirmation: Confirmation dialog to prevent accidental data loss
  • "Custom:" Prefix: All custom backgrounds are clearly labeled with "Custom:" prefix
  • Data Persistence: All custom backgrounds persist across sessions

Technical Changes

  1. Data Format: Custom backgrounds stored as JSON array in background-custom-templates preference:
    [
      { "id": "custom-1", "name": "My Tiles", "template": "https://..." },
      { "id": "custom-2", "name": "Berlin 2025", "template": "https://..." }
    ]

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements support for multiple custom background layers in the iD editor, addressing issue #8874. Previously, only a single custom background was supported. The implementation adds full CRUD operations for managing multiple named custom backgrounds with data persistence across sessions.

Changes:

  • Adds support for multiple custom backgrounds stored as JSON array in background-custom-templates preference
  • Implements UI for adding, editing, naming, and deleting custom backgrounds directly in the background list
  • Includes migration logic to convert existing single custom background to new multi-background format

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
modules/ui/settings/custom_background.js Modified to support editing both new and existing custom backgrounds with name and template fields
modules/ui/sections/custom_background_list.js New file (unused) that appears to be a duplicate/abandoned implementation
modules/ui/sections/background_list.js Integrated custom backgrounds list with edit/delete buttons into main background pane
modules/renderer/background_source.js Updated Custom factory to accept id and name parameters, show "Custom: {name}" prefix
modules/renderer/background.js Added migration logic and multi-custom background initialization
data/core.yaml Added localization strings for custom backgrounds UI
css/80_app.css Added styling for custom background list items and action buttons

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JaiswalShivang
Copy link
Contributor Author

@tordans - Thank you again for your detailed feedback on PR #11836. I've completely rewritten the implementation based on your guidance.
All Copilot AI feedback has been addressed:

  • No page reloads (dynamic UI updates)
  • Proper icons and i18n
  • Delete confirmation dialog
  • Input validation
  • Clean code with no dead files
    The PR is ready for your review. I appreciate your patience and mentorship!

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.

Add Custom 1, 2, 3 Backgrounds

2 participants