Get the current theme

My plugin embeds a third party iframe and I need to pass it some css style declarations so it renders properly in the current theme. On the dark theme, it renders black text on a dark background.

What is the best way for me to access the current theme in my component or the current route?

1 Like

We use this before action on every request:

It sets theme_ids on the controller.

But once you have the id I am not sure what you can do, there is nothing that says if it is dark or light… all you have is the theme css.



I got jQuery to tell me the colors and merged into the css of the iframe. It sort of works…