Skip to content

Instantly share code, notes, and snippets.

@onlyoneaman
Last active February 6, 2021 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onlyoneaman/8c814cda0563c9b3a1f9d8ab3a1c4e62 to your computer and use it in GitHub Desktop.
Save onlyoneaman/8c814cda0563c9b3a1f9d8ab3a1c4e62 to your computer and use it in GitHub Desktop.
/*global chrome*/
export async function changeColor() {
chrome.storage.sync.set({color: "#3aa757"}, ()=>{});
await chrome.tabs.query({active: true, currentWindow: true},
(
r => {
chrome.tabs.executeScript(r[0].id , {file: 'scripts/changeBgColor.js'}, function() {
if(chrome.runtime.lastError) {
console.error("Script injection failed: " + chrome.runtime.lastError.message);
}
})
}
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment