Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CSS background property in labels/text renderer #59450

Merged
merged 4 commits into from
Nov 21, 2024

Conversation

nyalldawson
Copy link
Collaborator

@nyalldawson nyalldawson commented Nov 15, 2024

This commit adds support for the CSS background-color and background-image properties when used with HTML labels.

  • Backgrounds are supported for block items (eg <div>) or inline items (eg <span>)
  • For images, the CSS should be formatted as background-image: url(xx). It supports local file paths, http links, or base64 embedded content
  • Backgrounds are not supported for curved text
  • HTML backgrounds are always rendered above any background shape for the label, and below drop shadows/buffers

Sponsored by City of Freiburg im Breisgau

@nyalldawson nyalldawson added Feature Needs Documentation When merging a labeled PR, an issue will be created in the Doc repo. Changelog Items that are queued to appear in the visual changelog - remove after harvesting labels Nov 15, 2024
@qgis-bot
Copy link
Collaborator

@nyalldawson
This pull request has been tagged as requiring documentation.

A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged.

Please update the description (not the comments) with helpful description and screenshot to help the work from documentors.
Also, any commit having [needs-doc] or [Needs Documentation] in will see its message pushed to the issue, so please be as verbose as you can.

Thank you!

@qgis-bot
Copy link
Collaborator

@nyalldawson

This pull request has been tagged for the changelog.

  • The description will be harvested so please provide a "nearly-ready" text for the final changelog
  • If possible, add a nice illustration of the feature. Only the first one in the description will be harvested (GIF accepted as well)
  • If you can, it's better to give credits to your sponsor, see below for different formats.

You can edit the description.

Format available for credits
  • Funded by NAME
  • Funded by URL
  • Funded by NAME URL
  • Sponsored by NAME
  • Sponsored by URL
  • Sponsored by NAME URL

Thank you!

@github-actions github-actions bot added this to the 3.42.0 milestone Nov 15, 2024
Copy link

github-actions bot commented Nov 15, 2024

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit ebd2120)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit ebd2120)

@DelazJ
Copy link
Contributor

DelazJ commented Nov 15, 2024

Backgrounds are supported for block items (eg
) or inline items (eg )

@nyalldawson you might want to escape the tags here.

@qgis qgis deleted a comment from github-actions bot Nov 15, 2024
@qgis qgis deleted a comment from github-actions bot Nov 15, 2024
This commit adds support for the CSS ``background-color`` and
``background-image`` properties when used with HTML labels.

- Backgrounds are supported for block items (eg ``<div>``) or inline
  items (eg ``<span>``)
- For images, the CSS should be formatted as ``background-image: url(xx)``.
  It supports local file paths, http links, or base64 embedded content
- Backgrounds are not supported for curved text
- HTML backgrounds are always rendered above any background shape for
  the label, and below drop shadows/buffers

Sponsored by City of Freiburg im Breisgau
@nyalldawson nyalldawson merged commit 2cb5f49 into qgis:master Nov 21, 2024
31 checks passed
@nyalldawson nyalldawson deleted the background_color branch November 21, 2024 19:59
@qgis-bot
Copy link
Collaborator

@nyalldawson
A documentation ticket has been opened at qgis/QGIS-Documentation#9401
It is your responsibility to visit this ticket and add as much detail as possible for the documentation team to correctly document this change.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog Items that are queued to appear in the visual changelog - remove after harvesting Feature Needs Documentation When merging a labeled PR, an issue will be created in the Doc repo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants