Expose colors and icons to extensions
Categories
(WebExtensions :: General, enhancement)
Tracking
(firefox153 fixed)
| Tracking | Status | |
|---|---|---|
| firefox153 | --- | fixed |
People
(Reporter: baku, Assigned: baku)
References
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
Currently, there is no exposed way to discover which colors and icons are available for add-ons to use with containers (there is just an MDN page).
This issue proposes exposing the complete list of available container colors and icons through a public API, so that add-ons can reliably use supported options.
| Assignee | ||
Comment 1•1 month ago
|
||
Updated•1 month ago
|
Comment 2•1 month ago
|
||
Depending on the shape of the API, this could also potentially fix bug 1405780.
Although this is a Container feature, I'd like to move this to WebExtensions::General because it is about an external facing extension API, and putting it there would make it easier to follow up with documentation needs. Does that sound good to you?
Comment 3•1 month ago
|
||
Adding dev-doc-needed so that this API can be documented.
The API does not introduce a new image format, it just returns a list of objects describing the supported color names and icons.
This bug will therefore not fix bug 1405780.
The note below is merely informative, it should NOT be documented on MDN as part of the public API because its behavior may be subject to change.
The way that the multi-account container extension colorizes their icons right now is through a SVG filter, introduced in https://github.com/mozilla/multi-account-containers/commit/53363865cb722e124f40da9f1d01a499f9fd4732
A fully-self contained example based on that technique is the following, showing a red briefcase (instead of black):
data:text/html,<div style='
width: 32px;
height: 32px;
background-image: url("resource://usercontext-content/briefcase.svg");
fill: red;
filter: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"><filter id="fill"><feComposite in="FillPaint" in2="SourceGraphic" operator="in"/></filter></svg>#fill');
'></div>
or even just an <img> instead of a background image:
data:text/html,<img src="resource://usercontext-content/briefcase.svg"
style='fill: red;
filter: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"><filter id="fill"><feComposite in="FillPaint" in2="SourceGraphic" operator="in"/></filter></svg>#fill');
'>
I hardcoded resource://usercontext-content/briefcase.svg in the above examples, but with the new API one could just fill in iconUrl and color.
This depends on the ability to specify an additional SVG filter to apply to the existing SVG. In HTML of extension pages that works because we can use HTML, but in browser UI that does not work, hence bug 1405780 remains open.
Comment 5•1 month ago
|
||
| bugherder | ||
Documentation updates in:
Description
•