For a WebExtension, we use browser.browserAction.setIcon
to set the icon. As you can see in this sample, to fit in, the icon should have a dark or light background.
How can my Javascript code know which theme is in effect? Or better, can I determine what the background color for the toolbar is so I can make an appropriate icon?
You can use the theme javascript api listed in webextensions to get theme details. Please make sure you add "theme" permission in your manifest.json
file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With