In "sandbox" mode, the background of the iframe is not responsive to dark mode #5034
Labels
Status: Triage
Needs to be verified, categorized, etc
Type: Bug / Error
Something isn't working or is incorrect
Description
Dear mermaid team, over at gollum, we're busy implementing dark mode. We run mermaid with
securityLevel: 'sandbox'
and noticed that the diagrams in the resultingiframe
are not automatically responsive to enabling/disabling dark mode (in System settings). We have worked around this by adding an event listener to(prefers-color-scheme: dark)'
and re-rendering the diagram with thedark
theme when dark mode is enabled. However, when we do, the background of the resultingiframe
remains white. I would expect the background of the iframe to assume the background color of the surrounding page.Steps to reproduce
Go to the Mermaid live editor and render the default diagram with the following settings:
Screenshots
dark
theme is used:This last screenshot does reflect what happens when we set
securityLevel: 'loose'
.Code Sample
No response
Setup
Suggested Solutions
This is not my expertise, so this may not be the best solution, but adding
to the
<head>
of theiframe
resolves the issue in gollum.I think the relevant code lives here in
putIntoIFrame
.Additional Context
Thanks for considering this issue! Please let us know (@dometto @benjaminwil) if there's anything we can do to help resolve it.
The text was updated successfully, but these errors were encountered: