W3cubDocs

/Web Extensions

theme.reset()

Resets any theme that was applied using the theme.update() method.

Note that this will always reset the theme back to the original default theme, even if the user had selected a different theme before this extension's theme was applied (see bug 1415267).

Syntax

browser.theme.reset(
  windowId     // integer
)

Parameters

windowId Optional
integer. The ID of a window. If this is provided, the theme applied to that window will be reset. If it is omitted the theme will be reset on all windows.

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
reset
No
No
56
?
No
No
?
?
No
?
?
?
windowId
No
No
57
?
No
No
?
?
No
?
?
?

Examples

This code applies a theme, then removes it when the user clicks a browser action:

browser.theme.update(themes.night);

browser.browserAction.onClicked.addListener(() => {
  browser.theme.reset();
});

Example extensions

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/theme/reset