Open Bug 1484840 Opened 7 years ago Updated 2 years ago

Add browserAction.setThemeIcons API

Categories

(WebExtensions :: Themes, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: Oriol, Unassigned)

Details

(Whiteboard: [design-decision-needed])

One can use theme_icons in the browser_action manifest API in order to define different icons for light themes than for dark ones. This is useful for simple extensions, but I need to generate my icons dynamically with browserAction.setIcon, so I can't define them in the manifest. However, I still want different icons for light and dark themes. So I want an API like `browser.browserAction.setThemeIcons(details)`, where `details` has these properties: - An optional `windowId` to restrict the theme icons to a single window - An optional `tabId` to restrict the theme icons to a single tab - Either an `imageData` or `path` property, whose value is an array of objects with these properties: - `dark`: an URL (for `path`) or an ImageData (for `imageData`) corresponding to a variant of the icon for themes with dark text - `light`: an URL (for `path`) or an ImageData (for `imageData`) corresponding to a variant of the icon for themes with light text - `size`: the size of both icons
Component: Frontend → Themes
Priority: -- → P3

Has this bug been forgotten?

Flags: needinfo?(mixedpuppy)

This looks like it's already technically implemented. ExtensionActions.jsm has setIcon, which eventually ends up in normalize that does indeed look for theme icons[1]. It may be that the schemas need to be modified.

[1] https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/toolkit/components/extensions/ExtensionParent.jsm#1591

Flags: needinfo?(mixedpuppy)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.