I'm trying to replace all colors I set with a different set of colors, right now I have it console.log'ing all the colors of the elements in the page my UserScript loads on so I know that it's getting the colors correctly, but for some reason it isn't changing the colors!
Help figuring out how to change the colors without having to get the class name of each individual element and manually changing it would be greatly appreciated, thanks!
(And I know I'm "connecting to the website" correctly, I started off manually changing the elements colors before I decided this would be a lot easier)
// ==UserScript==
// @name My Name Here
// @namespace http://tampermonkey.net/
// @version 1
// @description My Description
// @author iLordOfAviation
// @match Website I want to change
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
/' jshint -W097 '/
'use strict';
$(document).ready(function() {
var all = document.getElementsByTagName("*");
for (var i=0, max=all.length; i < max; i++) {
var element = all[i];
console.log($(element).css('color'));
if ($(element).css('color') === 'rgb(32, 50, 67)') {
$(element).css('color', 'rgb(33, 33, 33)')
} else {
if ($(element).css('color') === 'rgb(238, 244, 247)') {
$(element).css('color', 'rgb(250, 250, 250)')
} else {
if ($(element).css('color') === 'rgb(65, 99, 118)') {
$(element).css('color', 'rgb(211, 47, 47)')
} else {
if ($(element).css('color') === 'rgb(134, 189, 219)') {
$(element).css('color', 'rgb(211, 47, 47)')
}
}
}
}
}
});
rgb(32, 50, 67)
rgb(33, 33, 33)
rgb(88, 134, 160)
rgb(33, 33, 33)
rgb(65, 99, 118)
rgb(211, 47, 47)
rgb(255, 255, 255)
rgb(116, 153, 189)
rgb(33, 33, 33)
rgb(32, 50, 67)
rgb(33, 33, 33)
rgb(32, 50, 67)
^ Console example, this is just a few, there's hundreds or thousands of elements it's printing for