`/* EVENT LISTENERS
Needed to call the correct functions when the buttons are clicked by the user /
/ event listener for lights out: when light's out button clicked, call lightsOut function */
window.addEventListener('load', function load(event)
{
var createButton = document.getElementById('lightsOut');
createButton.addEventListener('click', function() { lightsOut() });
})
/* event listener for dark: when dark button clicked, call dark function */
window.addEventListener('load', function load(event)
{
var createButton = document.getElementById('dark');
createButton.addEventListener('click', function() { dark() });
})
/* set the background color of the popup window when the user clicks the toolbar icon */
chrome.browserAction.onClicked.addListener(function setTheme()
{
chrome.storage.sync.get(['themeToUse'], function(result)
{
console.log('Set browser action body background color!');
document.body.style.backgroundColor = result.themeToUse;
});
})`
I haven't tried this to confirm it works but something similar should work.