How to change the color or highlighted status of a tab

I am about to develop a add-on or web extension for Firefox, mainly fueled by the lack of several existing add-ons to properly port over. I understand this may be due to the non-existence of certain needed api’s to perform certain tasks.

Which method/function/api call would I use to change the highlight status of a extension. I was looking at the following page and am not able ti find one that’s supported by the latest version of Firefox:

Is this just old data or am I looking in the wrong place? I want to make sure I am using the right documentation before moving forward with this.

Thank you for any assistance/direction.

Jeff

You need to be looking at WebExtensions, which you are. However, you also need to check the Browser compatibility section for anything which you are wanting to use.

For instance, the Browser compatibility section for tabs.highlight() very clearly indicates that it’s only supported on Chrome, where it would be chrome.tabs.highlight() and callback based, not Promise based.

Thank you for showing me about callback and promise based, I didn’t realize what that was before your post. However the point of this post is me seeking an alternative. I see from the matrix at the bottom of each of these pages that it’s not supported. I’m trying to create an unread tab feature which I took for granted in previous versions of Firefox due to the now obsolete extensions that provided it. I provided the tabs.highlight() method as an example but I’m sure there’s a way or a different method to change the color of tabs?

Changing the color of the tab: It would be nice to have. I don’t believe it exists. I seem to recall reading a discussion on providing something that might work. Perhaps in this bug on Bugzilla about themes for tabs.

With respect to callback vs. Promise based APIs: Firefox supports both callback based APIs, using chrome.*, and Promise based APIs, using browser.*. Chrome supports callback APIs using chrome.*. For compatibility between the two you can either just use the callback APIs, or you can add a polyfill to any Chrome version of your extension (which introduces it’s own bugs/issues).

1 Like

Thank you for this information. This was exactly what I was looking for. By the looks of this bug it’s very active and hopefully this gets implemented in some way soon.