Have extension icon change color by what tab is open to indicate whether its enabled or not #29

Closed
opened 2025-02-22 16:23:51 -05:00 by jean · 6 comments
Owner
No description provided.
jean pinned this 2025-06-26 22:11:28 -04:00
Author
Owner
https://github.com/classvsoftware/example-chrome-extension/blob/master/components/modify-toolbar-icon/modify-toolbar-icon.js
Author
Owner
  • Add neutral (not disabled/enabled) icon version
  • Add service worker script to update the icon when changing tabs
  • Add service worker to manifest.json
  • Add service worker to rollup config
  • Set icon to dark/light when changing theme
  • Set icon to enabled/disabled/invalid when moving to an enabled/disabled/invalid tab (Bitwarden does this)
  • Set icon when enabling/disabling a tab (in popup, maybe?)
  • Add theme_icons to manifest.json, even though they're Firefox-only :(

Here's an example of this being done for Chrome with background scripts, which have been deprecated with Manifest V3.

- [x] Add neutral (not disabled/enabled) icon version - [x] Add service worker script to update the icon when changing tabs - [x] Add service worker to manifest.json - [x] Add service worker to rollup config - [x] [Set icon](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction/setIcon) to dark/light when changing theme - [x] Set icon to enabled/disabled/invalid when moving to an enabled/disabled/invalid tab (Bitwarden does this) - [x] Set icon when enabling/disabling a tab (in popup, maybe?) - [x] [Add theme_icons](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/action) to manifest.json, even though they're Firefox-only :( [Here](https://stackoverflow.com/questions/58880234/toggle-chrome-extension-icon-based-on-light-or-dark-mode-browser)'s an example of this being done for Chrome with background scripts, which have been deprecated with Manifest V3.
Author
Owner

Update: only Chrome works with service workers. Firefox wants background pages still.

Update: only Chrome works with service workers. Firefox wants background pages still.
Author
Owner

Here is a service worker version of this, for reference.

[Here](https://github.com/Zren/RecentBookmarksPopup/blob/master/src/serviceworker.js) is a service worker version of this, for reference.
Author
Owner
  • Make sure that theme is being set when extension is first loaded and not just set to default
- [x] Make sure that theme is being set when extension is first loaded and not just set to default
Author
Owner
  • Test on Chrome
- [x] Test on Chrome
jean closed this issue 2025-06-29 16:11:04 -04:00
jean unpinned this 2025-06-29 16:11:10 -04:00
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: jean/metamorpov#29
No description provided.