files/en-us/mozilla/add-ons/webextensions/manifest.json/theme_experiment/index.md
This key enables the definition of experimental theme key properties for the Firefox interface. These experiments are a precursor to proposing new theme features for inclusion in Firefox. Experimentation is done by:
colors, images, and properties objects to new theme key properties.colors, images, and properties to map internal Firefox CSS selectors, such as --arrowpanel-dimmed to new theme key properties. This option limits experimentation to UI components that are associated with an inbuilt CSS variable.To discover the CSS selectors for Firefox UI elements or internal Firefox CSS variables use the browser toolbox.
[!NOTE] This key is only available for use in Firefox Developer Edition and Firefox Nightly channels and requires the
extensions.experiments.enabledpreference to be enabled. In Firefox 73 and earlier, theextensions.legacy.enabledhad to be used instead.
[!WARNING] This feature is experimental and could be subject to change.
The theme_experiment key is an object that takes the following properties:
<table class="fullwidth-table standard-table"> <thead> <tr> <th scope="col">Name</th> <th scope="col">Type</th> <th scope="col">Description</th> </tr> </thead> <tbody> <tr> <td><code>stylesheet</code></td> <td><code>String</code></td> <td> <p>Optional</p> <p> Name of a stylesheet providing mapping of Firefox UI element CSS selectors to CSS variables. </p> </td> </tr> <tr> <td><code>images</code></td> <td><code>Object</code></td> <td> <p>Optional</p> <p> Mappings of CSS variables (as defined in Firefox or by the stylesheet defined in <code>stylesheet</code>) to <code>images</code> property names for use in the <code ><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/theme" >theme</a ></code > key. </p> </td> </tr> <tr> <td><code>colors</code></td> <td><code>Object</code></td> <td> <p>Optional</p> <p> Mappings of CSS variables (as defined in Firefox or by the stylesheet defined in <code>stylesheet</code>) to <code>colors</code> property names for use in the <code ><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/theme" >theme</a ></code > key. </p> </td> </tr> <tr> <td><code>properties</code></td> <td><code>Object</code></td> <td> <p>Optional</p> <p> Mappings of CSS variables (as defined in Firefox or by the stylesheet defined in <code>stylesheet</code>) to <code>properties</code> property names for use in the <code ><a href="/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/theme" >theme</a ></code > key. </p> </td> </tr> </tbody> </table>This example uses a stylesheet named style.css to provide the ability to set a color for the browser reload button in the theme key.
The stylesheet defines:
#reload-button {
fill: var(--reload-button-color);
}
where #reload-button is the Firefox internal CSS selector for the reload button and --reload-button-color is an arbitrary name.
In the manifest.json file, --reload-button-color is then mapped to the name to be used in the colors property of theme:
"theme_experiment": {
"stylesheet": "style.css",
"colors": {
"reload_button": "--reload-button-color"
}
}
The argument reload_button is used in the same way as any other theme property:
"theme": {
"colors": {
"reload_button": "orange"
}
}
This has the effect of making the reload icon orange.
This property can also be used in browser.theme.update(). images and properties work in a similar way to colors.
{{Compat}}