The issue is with setting a custom background color for an iframe in a Discourse forum post. lyt attempted to change the iframe background color using inline styles, but it didn’t work in dark mode. SaraDev suggested using custom CSS to set the background color, as styles/classes are stripped out of posts by default. The solution involves wrapping the iframe in a div with a custom attribute and adding CSS to target that attribute. lyt confirmed that this solution worked.
I recently embedded some visualizations into a forum (powered by discourse) post and they look unfortunately terrible in dark mode because the iframes have transparent backgrounds.
So I tried to change the background color of the iframes. I found how and tested it on hackmd; it worked well. But when I submit it on the discourse forum, it doesn’t work! Dark mode prevails.
You’ll likely need to use custom CSS to set a custom background color for your iframe, as styles/classes are stripped out of all posts on Discourse by default.