# Get the current theme

**URL:** https://meta.discourse.org/t/get-the-current-theme/126994
**Category:** Development
**Created:** [August 28, 2019, 6:49am UTC](https://meta.discourse.org/t/get-the-current-theme/126994 "2019-08-28T06:49:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rimian](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rimian/32/120658_2.png) [@rimian](https://meta.discourse.org/u/rimian)
#### Post date: [August 28, 2019, 6:49am UTC](https://meta.discourse.org/t/get-the-current-theme/126994/1 "2019-08-28T06:49:14Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 28, 2019, 8:23am UTC](https://meta.discourse.org/t/get-the-current-theme/126994/2 "2019-08-28T08:23:00Z")

</div>

We use this before action on every request:

> <https://github.com/discourse/discourse/blob/aaafbd1ae5d5e071d0fcd25ee323533eb294bf5f/app/controllers/application_controller.rb#L46-L46>

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.

---

<div class="post-metadata">

### Author: ![rimian](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rimian/32/120658_2.png) [@rimian](https://meta.discourse.org/u/rimian)
#### Post date: [August 28, 2019, 9:07am UTC](https://meta.discourse.org/t/get-the-current-theme/126994/3 "2019-08-28T09:07:35Z")

</div>

Cheers!

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