change extension icon after pressing a button

How to do this on chrome and firefox?
6 Replies
RVG|𝓡𝓸𝓻𝔂
Ping me when reply
jgoon
jgoonβ€’15mo ago
I don't think plasmo has built an api for this, so simply use the browsers native api chrome.browserAction.setIcon https://developer.chrome.com/docs/extensions/reference/browserAction/
Chrome for Developers
chrome.browserAction - Chrome for Developers
Build the next generation of web experiences.
jgoon
jgoonβ€’15mo ago
example use case:
const path = {
"16": "assets/icon16.png",
"48": "assets/icon48.png",
"128": "assets/icon128.png"
};

chrome.browserAction.setIcon({ path });
const path = {
"16": "assets/icon16.png",
"48": "assets/icon48.png",
"128": "assets/icon128.png"
};

chrome.browserAction.setIcon({ path });
Arcane
Arcaneβ€’15mo ago
@jgoon has reached level 1. GG!
RVG|𝓡𝓸𝓻𝔂
And what about for firefox?
jgoon
jgoonβ€’15mo ago
in the background script, you can use plasmo's browser api which will dynamically change based which browser you are on i think you need to config the action in the manifest although
Want results from more Discord servers?
Add your server