You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
542 B
17 lines
542 B
5 years ago
|
let changeColor = document.getElementById('changeColor')
|
||
|
chrome.storage.sync.get('color', function(data) {
|
||
|
changeColor.style.backgroundColor = data.color
|
||
|
changeColor.setAttribute('value', data.color)
|
||
|
})
|
||
|
changeColor.onclick = function(element) {
|
||
|
let color = element.target.value
|
||
|
chrome.tabs.query({
|
||
|
active: true,
|
||
|
currentWindow: true
|
||
|
}, function(tabs) {
|
||
|
chrome.tabs.executeScript(
|
||
|
tabs[0].id,
|
||
|
{code: 'document.body.style.backgroundColor = "' + color + '";'}
|
||
|
)
|
||
|
})
|
||
|
}
|