How to handle dark mode-specific styling in back-end?

I’m working on adding dark mode to my site, and some elements require manual tweaking.

My thought was to approach this by adding a relative selector such as:

This works great on the front-end, but doesn’t show the styling on the back-end.

That’s because the dark mode selector (.dark) is applied to the <html> element, but the CSS generated inside the editor is:

.editor-styles-wrapper .dark .my-section

.editor-styles-wrapper is of course applied to the body tag, so this selector won’t work.

Any ideas on how we could apply styling using the dark mode selector on the back-end?

1 Like

Hi @sunny,

Thank you for bringing this to our attention!

Indeed, this is a current limitation that we plan to address as soon as possible.
Rest assured, I’ll forward this to @Louis to ensure the best possible solution.

I’ll also move this to planned Feature Requests to keep a better track of it.

Thank you for your understanding.

2 Likes

Thanks @Araminta :slight_smile: Looking forward to it!

2 Likes