theme API

The theme API allows for customization of Thunderbird’s visual elements.

Manifest file properties

theme_experiment

[theme_experiment]

(ThemeExperiment, optional)

– [Added in TB 86]

A theme experiment allows modifying the user interface of Thunderbird beyond what is currently possible using the built-in color, image and property keys of ThemeType. These experiments are a precursor to proposing new theme features for inclusion in Thunderbird. Experimentation is done by mapping internal CSS color, image and property variables to new theme keys and using them in ThemeType and by loading additional style sheets to add new CSS variables, extending the theme-able areas of Thunderbird. Can be used in static and dynamic themes.

Permissions

The following permissions influence the behavior of the API. Depending on which permissions are requested, additional methods might be available, or certain data may be included in responses.

Hint

Request permissions only when needed. Unnecessary requests may result in rejection during ATN review.

theme

theme

Grant access to some or all methods of the theme API.

Functions

getCurrent([windowId])

– [Added in TB 86]

Returns the current theme for the specified window or the last focused window.

Parameters

windowId

[windowId]

(integer, optional)

The window for which we want the theme.

Return type (Promise)

_returns

– [Added in TB 96]

reset([windowId])

– [Added in TB 86]

Removes the updates made to the theme.

Parameters

windowId

[windowId]

(integer, optional)

The id of the window to reset. No id resets all windows.

Required permissions

  • theme

update([windowId], details)

– [Added in TB 86]

Make complete updates to the theme. Resolves when the update has completed.

Parameters

windowId

[windowId]

(integer, optional)

The id of the window to update. No id updates all windows.

details

details

The properties of the theme to update.

Required permissions

  • theme

Events

onUpdated

– [Added in TB 86]

Fired when a new theme has been applied

Parameters for onUpdated.addListener(listener)

listener(updateInfo)

listener(updateInfo)

A function that will be called when this event occurs.

Parameters passed to the listener function

updateInfo

updateInfo

Details of the theme update

Types

ExtensionURL

A path relative to the root of the extension.

string

ImageDataOrExtensionURL

Defines an image resource. Either a image URL relative the the extensions manifest.json file (supported image formats are JPEG, PNG, APNG, SVG and GIF), or a data URL using a base64 encoded representation of a PNG or JPEG image.

Example for a base64 encoded PNG image:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==

string

ThemeColor

– [Added in TB 86]

Defines a color value.

string

A string containing a valid CSS color string, including hexadecimal or functional representations. For example the color crimson can be specified as:

  • crimson

  • #dc143c

  • rgb(220, 20, 60) (or rgba(220, 20, 60, 0.5) to set 50% opacity)

  • hsl(348, 83%, 47%) (or hsla(348, 83%, 47%, 0.5) to set 50% opacity)

or

array of integer

An RGB array of 3 integers. For example [220, 20, 60] for the color crimson.

or

array of number

An RGBA array of 3 integers and a fractional (a float between 0 and 1). For example [220, 20, 60, 0.5] for the color crimson with 50% opacity.

ThemeExperiment

– [Added in TB 86]

Defines additional color, image and property keys to be used in ThemeType, extending the theme-able areas of Thunderbird.

object

colors

[colors]

(object, optional)

A dictionary object with one or more key-value pairs to map new theme color keys to internal Thunderbird CSS color variables. The new color key is usable as a color reference in ThemeType.

The following example maps the theme color key popup_affordance to the CSS variable –arrowpanel-dimmed:

{
  "popup_affordance": "--arrowpanel-dimmed"
}

images

[images]

(object, optional)

A dictionary object with one or more key-value pairs to map new theme image keys to internal Thunderbird CSS image variables. The new image key is usable as an image reference in ThemeType.

The following example maps the theme image key theme_toolbar to the CSS variable –toolbar-bgimage:

{
  "theme_toolbar": "--toolbar-bgimage"
}

properties

[properties]

(object, optional)

A dictionary object with one or more key-value pairs to map new theme property keys to internal Thunderbird CSS property variables. The new property key is usable as a property reference in ThemeType.

The following example maps the theme property key toolbar_image_alignment to the CSS variable –toolbar-bgalignment:

{
  "toolbar_image_alignment": "--toolbar-bgalignment"
}

stylesheet

[stylesheet]

(ExtensionURL, optional)

URL to a stylesheet introducing additional CSS variables, extending the theme-able areas of Thunderbird.

The theme_experiment add-on in our example repository is using the stylesheet shown below, to add the –chat-button-color CSS variable:

image.toolbarbutton-icon[label="Chat"] {
  fill: var(--chat-button-color);
}

The following manifest.json file maps the –chat-button-color CSS variable to the theme color key exp_chat_button and uses it to set a color for the chat button:

{
  "name": "Theme Experiment",
  "description": "Changing the color of the chat icon using a theme_experiment.",
  "version": "1",
  "applications": {
    "gecko": {
      "id": "[email protected]",
      "strict_min_version": "78.0"
    }
  },
  "manifest_version": 2,
  "theme_experiment": {
    "stylesheet": "style.css",
    "colors": {
      "exp_chat_button": "--chat-button-color"
    }
  },
  "theme": {
    "colors": {
      "exp_chat_button": "orange"
    }
  }
}

ThemeManifest

– [Added in TB 86]

Contents of manifest.json for a static theme

object

theme

theme

Properties for a static theme. A static theme must not contain any other WebExtension logic. If additional logic is required, request the theme permission and load/update the theme dynamically. More information about themes can be found in the theme guide

dark_theme

[dark_theme]

(ThemeType, optional)

Fallback properties for the dark system theme in a static theme.

default_locale

[default_locale]

(string, optional)

icons

[icons]

(object, optional)

Icons shown in the Add-ons Manager.

theme_experiment

[theme_experiment]

(ThemeExperiment, optional)

CSS file with additional styles.

ThemeType

– [Added in TB 86]

Contains the color, image and property settings of a theme.

object

colors

[colors]

(object, optional)

A dictionary object with one or more key-value pairs to map color values to theme color keys. The following built-in theme color keys are supported:

accentcolor

[accentcolor]

(ThemeColor, optional) Deprecated.

bookmark_text

[bookmark_text]

(ThemeColor, optional)

Not used in Thunderbird.

button_background_active

[button_background_active]

(ThemeColor, optional)

The color of the background of the pressed toolbar buttons.

button_background_hover

[button_background_hover]

(ThemeColor, optional)

The color of the background of the toolbar buttons on hover.

frame

[frame]

(ThemeColor, optional)

The background color of the header area.

frame_inactive

[frame_inactive]

(ThemeColor, optional)

The background color of the header area when the window is inactive.

icons

[icons]

(ThemeColor, optional)

The color of the toolbar icons. Defaults to the color specified by toolbar_text.

icons_attention

[icons_attention]

(ThemeColor, optional)

The color of the toolbar icons in attention state such as the chat icon with new messages.

ntp_background

[ntp_background]

(ThemeColor, optional)

Not used in Thunderbird.

ntp_text

[ntp_text]

(ThemeColor, optional)

Not used in Thunderbird.

popup

[popup]

(ThemeColor, optional)

The background color of popups such as the AppMenu.

popup_border

[popup_border]

(ThemeColor, optional)

The border color of popups.

popup_highlight

[popup_highlight]

(ThemeColor, optional)

The background color of items highlighted using the keyboard inside popups.

popup_highlight_text

[popup_highlight_text]

(ThemeColor, optional)

The text color of items highlighted using the keyboard inside popups.

popup_text

[popup_text]

(ThemeColor, optional)

The text color of popups.

sidebar

[sidebar]

(ThemeColor, optional)

The background color of the trees.

sidebar_border

[sidebar_border]

(ThemeColor, optional)

The border color of the trees.

sidebar_highlight

[sidebar_highlight]

(ThemeColor, optional)

The background color of highlighted rows in trees.

sidebar_highlight_border

[sidebar_highlight_border]

(ThemeColor, optional)

The border color of highlighted rows in trees.

sidebar_highlight_text

[sidebar_highlight_text]

(ThemeColor, optional)

The text color of highlighted rows in trees.

sidebar_text

[sidebar_text]

(ThemeColor, optional)

The text color of the trees. Needed to enable the tree theming.

tab_background_separator

[tab_background_separator]

(ThemeColor, optional)

The color of the vertical separator of the background tabs.

tab_background_text

[tab_background_text]

(ThemeColor, optional)

The text color of the unselected tabs.

tab_line

[tab_line]

(ThemeColor, optional)

The color of the selected tab line.

tab_loading

[tab_loading]

(ThemeColor, optional)

The color of the tab loading indicator.

tab_selected

[tab_selected]

(ThemeColor, optional)

Background color of the selected tab. Defaults to the color specified by toolbar.

tab_text

[tab_text]

(ThemeColor, optional)

The text color for the selected tab. Defaults to the color specified by toolbar_text.

textcolor

[textcolor]

(ThemeColor, optional) Deprecated.

toolbar

[toolbar]

(ThemeColor, optional)

The background color of the toolbars. Also used as default value for tab_selected.

toolbar_bottom_separator

[toolbar_bottom_separator]

(ThemeColor, optional)

The color of the line separating the bottom of the toolbar from the region below.

toolbar_field

[toolbar_field]

(ThemeColor, optional)

The background color for fields in the toolbar, such as the search field.

toolbar_field_border

[toolbar_field_border]

(ThemeColor, optional)

The border color for fields in the toolbar.

toolbar_field_border_focus

[toolbar_field_border_focus]

(ThemeColor, optional)

The focused border color for fields in the toolbar.

toolbar_field_focus

[toolbar_field_focus]

(ThemeColor, optional)

The focused background color for fields in the toolbar.

toolbar_field_highlight

[toolbar_field_highlight]

(ThemeColor, optional)

The background color used to indicate the current selection of text in the search field.

toolbar_field_highlight_text

[toolbar_field_highlight_text]

(ThemeColor, optional)

The color used to draw text that’s currently selected in the search field.

toolbar_field_separator

[toolbar_field_separator]

(ThemeColor, optional) Deprecated.

Not used in Thunderbird.

toolbar_field_text

[toolbar_field_text]

(ThemeColor, optional)

The text color for fields in the toolbar.

toolbar_field_text_focus

[toolbar_field_text_focus]

(ThemeColor, optional)

The text color in the focused fields in the toolbar.

toolbar_text

[toolbar_text]

(ThemeColor, optional)

The text color in the main Thunderbird toolbar. Also used as default value for icons and tab_text.

toolbar_top_separator

[toolbar_top_separator]

(ThemeColor, optional)

The color of the line separating the top of the toolbar from the region above.

toolbar_vertical_separator

[toolbar_vertical_separator]

(ThemeColor, optional)

The color of the vertical separators on the toolbars.

images

[images]

(object, optional)

A dictionary object with one or more key-value pairs to map images to theme image keys. The following built-in theme image keys are supported:

additional_backgrounds

[additional_backgrounds]

(array of ImageDataOrExtensionURL, optional)

Additional images added to the header area and displayed behind the theme_frame image.

headerURL

[headerURL]

(ImageDataOrExtensionURL, optional) Deprecated.

theme_frame

[theme_frame]

Foreground image on the header area.

properties

[properties]

(object, optional)

A dictionary object with one or more key-value pairs to map property values to theme property keys. The following built-in theme property keys are supported:

additional_backgrounds_alignment

[additional_backgrounds_alignment]

(array of string, optional)

Supported values:

bottom

center

center bottom

center center

center top

left

left bottom

left center

left top

right

right bottom

right center

right top

top

additional_backgrounds_tiling

[additional_backgrounds_tiling]

(array of string, optional)

Supported values:

no-repeat

repeat

repeat-x

repeat-y

color_scheme

[color_scheme]

(string, optional)

– [Added in TB 100]

If set, overrides the general theme (context menus, toolbars, content area).

Supported values:

auto

auto

dark

dark

light

light

content_color_scheme

[content_color_scheme]

(string, optional)

– [Added in TB 100]

If set, overrides the color scheme for the content area.

Supported values:

auto

auto

dark

dark

light

light

ThemeUpdateInfo

– [Added in TB 86]

Info provided in the onUpdated listener.

object

theme

theme

The new theme after update

windowId

[windowId]

(integer, optional)

The id of the window the theme has been applied to