# Browser.theme API

**URL:** <https://discourse.mozilla.org/t/browser-theme-api/16436>\
**Category:** Development\
**Created:** [June 15, 2017, 6:54pm UTC](https://discourse.mozilla.org/t/browser-theme-api/16436 "2017-06-15T18:54:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefanvd](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@stefanvd](https://discourse.mozilla.org/u/stefanvd)\
**Post date:** [June 15, 2017, 6:54pm UTC](https://discourse.mozilla.org/t/browser-theme-api/16436/1 "2017-06-15T18:54:03Z")

</div>

Hi everyone,

In the last blog post for Firefox v55.  
[https://blog.mozilla.org/addons/2017/06/14/webextensions-firefox-55/comment-page-1/#comment-224016](https://blog.mozilla.org/addons/2017/06/14/webextensions-firefox-55/comment-page-1/#comment-224016)

There is support for the browser.theme, I already got this working in my Turn Off the Lights Firefox extension. And it works great! However, I got few issues:

- It doesn’t support the “theme” as “optional\_permissions” (in the manifest file)
- Is there a way to detect the current browser theme, this set it back later

Thanks,  
Stefan  
Developer  
[www.turnoffthelights.com](http://www.turnoffthelights.com)

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [June 16, 2017, 12:12am UTC](https://discourse.mozilla.org/t/browser-theme-api/16436/2 "2017-06-16T00:12:03Z")

</div>

> [@stefanvd](#):
>
> Is there a way to detect the current browser theme, this set it back later

Considering this is still open, I think not:

> **[1329242 - Ability to specify a different icon for browserActions in dark themes.](https://bugzilla.mozilla.org/show_bug.cgi?id=1329242)**
>
> RESOLVED (matthewjwein) in WebExtensions - Untriaged. Last updated 2023-01-13.

---

<div class="post-metadata">

**Author:** ![stefanvd](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@stefanvd](https://discourse.mozilla.org/u/stefanvd)\
**Post date:** [June 16, 2017, 8:33pm UTC](https://discourse.mozilla.org/t/browser-theme-api/16436/3 "2017-06-16T20:33:45Z")

</div>

Thank you Niklas for the link!

It is strange why Firefox only lets set the browser theme API. And not the “read” current theme status.

Thanks,  
Stefan

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [June 21, 2017, 11:34am UTC](https://discourse.mozilla.org/t/browser-theme-api/16436/4 "2017-06-21T11:34:29Z")

</div>

Hm. It may be possible. This example assumes that there is only ever one extension of the type theme active, enabling another will disable the previous one:

> <https://github.com/mdn/webextensions-examples/blob/master/theme-switcher/switcher.js>

---

<div class="post-metadata">

**Author:** ![stefanvd](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@stefanvd](https://discourse.mozilla.org/u/stefanvd)\
**Post date:** [June 21, 2017, 11:47am UTC](https://discourse.mozilla.org/t/browser-theme-api/16436/5 "2017-06-21T11:47:19Z")

</div>

But what if you use the default Firefox theme, and want to go back to this default Firefox theme.  
There is no Theme extension?

Thanks,  
Stefan

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [June 21, 2017, 11:53am UTC](https://discourse.mozilla.org/t/browser-theme-api/16436/6 "2017-06-21T11:53:59Z")

</div>

Apparently, there is (and there is also an entry on the `about:addons` page):

 ![](https://us1.discourse-cdn.com/flex001/uploads/mozilla/original/2X/c/ca3ce30e29a63a2d5e8336dd31b6f326c66f4e01.png)

---

<div class="post-metadata">

**Author:** ![stefanvd](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@stefanvd](https://discourse.mozilla.org/u/stefanvd)\
**Post date:** [June 25, 2017, 1:51pm UTC](https://discourse.mozilla.org/t/browser-theme-api/16436/7 "2017-06-25T13:51:11Z")

</div>

Hi Niklas,

Is there a way without the “management” permission?  
And do you find a complete _browser.theme_ API list. (of what you can change in the Firefox web browser)

Thanks,  
Stefan

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [June 26, 2017, 1:52pm UTC](https://discourse.mozilla.org/t/browser-theme-api/16436/8 "2017-06-26T13:52:59Z")

</div>

Unfortunately, this “[engineering plan](https://docs.google.com/document/d/1ueD6V7aLLTuc1GAOxxQYcwl2HR-k62HHu3q8knTJ4FU/pub)” is the only document with actual API information I could find. It has no date on it, but I think I ran across the very same thing at least two month ago.

This lack of documentation makes it hard to answer your other question, but I think the `management` API is, and will be, the way to go here.
