At the moment, it only works for some web pages, and it only changes some of the text's color.
background.js
chrome.browserAction.onClicked.addListener(function(tab) {
// No tabs or host permissions needed!
console.log('Turning ' + tab.url + ' red!');
chrome.tabs.executeScript({
code: 'document.body.style.color="red"'
});
});
Iterate through ALL tags and change the color :
var el = document.getElementsByTagName("*");
for (var i=0; i < el.length; i++)
{
el[i].style.color = "Red";
}
Tested this, works on Google & Stackoverflow
PS The JS code needs to go in executeScript
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.