Skip to content

Commit

Permalink
Dark theme support in embedded options pages fix (#35778)
Browse files Browse the repository at this point in the history
  • Loading branch information
rebloor authored Sep 9, 2024
1 parent 2ad6d0c commit a3f3d02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ To create an options page, write an HTML file defining the page. This page can i
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="color-scheme" content="dark light" />
</head>

<body>
Expand All @@ -39,6 +40,8 @@ To create an options page, write an HTML file defining the page. This page can i
</html>
```

Note the use of `<meta name="color-scheme" content="dark light">`. This enables automatic switching between light and dark themes in the embedded UI based on the user's browser preferences.

JavaScript running in the page can use all the [WebExtension APIs](/en-US/docs/Mozilla/Add-ons/WebExtensions/API) that the add-on has [permissions](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions) for. In particular, you can use the [`storage`](/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage) API to persist preferences.

Package the page's files in your extension.
Expand Down
1 change: 1 addition & 0 deletions files/en-us/mozilla/firefox/releases/127/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ This article provides information about the changes in Firefox 127 that affect d
- [`host_permissions`](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/host_permissions) for Manifest V3 extensions are now displayed to users during installation ([Firefox bug 1889402](https://bugzil.la/1889402)). However, if an extension update requests new host permissions, these are not shown to the user. See ([Firefox bug 1893232](https://bugzil.la/1893232)).
- Addition of the {{WebExtAPIRef("runtime.getContexts")}} function that returns information about the contexts associated with the extension ([Firefox bug 1875480](https://bugzil.la/1875480)).
- For Manifest V3 extensions, adds fall back to the user-defined shortcuts for the special [`_execute_browser_action`](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/commands#special_shortcuts) command if there are no user-defined shortcuts for `_execute_action`. This enables extensions migrating from Manifest V2 to V3 to preserve any user-defined shortcuts for the browser action ([Firefox bug 1797811](https://bugzil.la/1797811)).
- Extensions with an embedded [options page](/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Options_pages) now support automatic switching to the dark theme based on user preferences ([Firefox bug 1888866](https://bugzil.la/1888866)).

## Experimental web features

Expand Down

0 comments on commit a3f3d02

Please sign in to comment.