I am currently developing a small Firefox add-on designed to make reading pages at night more comfortable. The goal is to invert page colors without affecting images. Here is the code snippet I am using:
document.body.style.filter = "invert(100%)";
var imgs = document.getElementsByTagName("img");
for (var i = 0; i < imgs.length; i++) {
imgs[i].style.removeProperty("filter"); // This line does not work
imgs[i].style.filter = "invert(0%)"; // Nor does this line
}
The issue I am facing is that the code is not functioning as intended - the images are still being inverted, even though inspect element in Firefox shows that they have the correct invert(0%) style applied.