web_extensions / latest / api / theme.html

theme

Enables browser extensions to update the browser theme.

To use this API, an extension must request the "theme" permission in its manifest.json file.

Note: When we set up a theme in a background file, we must declare the 'theme' permission and therefore we cannot use the theme function of the manifest, since it's not compatible.

Types

theme.Theme

Represents the content of a theme.

Functions

theme.getCurrent()

Gets the current browser theme.

theme.update()

Updates the browser's theme.

theme.reset()

Removes any theme updates made in a call to theme.update().

Events

theme.onUpdated

Fired when the browser theme has been changed.

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
Theme No No 55 ? No No ? ? No ? No ?
getCurrent No No 58 ? No No ? ? No ? No ?
onUpdated No No 58 ? No No ? ? No ? No ?
reset No No 56 ? No No ? ? No ? No ?
update No No 55 ? No No ? ? No ? No ?

Example extensions

© 2005–2023 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