Issue Bug Under Review Stale

#110386 SVG icons rendered via `<img>` cannot adapt their color for dark mode.

Tim Weisenberger 08/06/26, 19:26 updated 08/06/26, 19:28

Description

`SvgIconProvider::generateMarkup()` renders the default (non-inline) icon markup as a plain `...svg` tag. Because the SVG is loaded as an external image resource, its content is opaque to the host document: CSS from the page (e.g. `currentColor`, or dark/light backend theme rules) cannot reach into the SVG.

`AbstractSvgIconProvider` already solves this for the `“inline”` markup identifier via `generateInlineMarkup()` / `getInlineSvg()`, which embeds the sanitized SVG directly into the DOM where it can be styled normally. That inline path is only used when a caller explicitly requests `$icon->getMarkup(‘inline’)`, though — the default `$icon->getMarkup()` still returns the `` variant, so those icons don’t adapt correctly between dark and non-dark mode.

Steps to reproduce

1. Render an SVG icon via `SvgIconProvider` using the default markup (no identifier).
2. Switch between dark and light backend mode.

Expected behaviour

The icon adapts its color in both dark and non-dark mode, since the markup is inline SVG and styleable.

Actual behaviour

The default markup renders an `` tag, so CSS color rules cannot affect the icon and it keeps its baked-in SVG color.

Reviews 1

History 01