Post Reply 
Website Background Color – Any reliable method to change it? [SOLVED]
Feb. 01, 2016, 09:53 PM (This post was last modified: Feb. 02, 2016 05:26 PM by Faxopita.)
Post: #1
Website Background Color – Any reliable method to change it? [SOLVED]
Any Userscript to help me solve this? Basically, I would like to swap the white background color found on most websites for something like gray. I'd be extremely thankful to our Greasemonkey specialist Cattleyavns if he could offer us a good solution as well.

I tried the following solution taken from here, but unfortunately with no effect for most of the websites I visit:
Code:
FILTER: GM_function
s@(^[^;]*?(?:<head[^>]*?>|<body[^>]*?>|<script[^>]*?>[^>]*?</script>))@<script src="https://greasyfork.org/en/scripts/9320-gm-function/code.user.js"></script>\n$1@i

FILTER: WebsiteBackground
s@(^[^;]*?(?:<head[^>]*?>|<body[^>]*?>|<script[^>]*?>[^>]*?</script>))@<script>\n\
(function () {\n\
    'use strict';\n\
    document.addEventListener('DOMContentLoaded', function (e) {\n\
    if (window.getComputedStyle(document.body, null).getPropertyValue("background-color") == "rgb(255, 255, 255)") {\n\
        console.log("Setting new background color...");\n\
        document.body.setAttribute("style", "background-color: \#98AFC7;");\n\
    }\n\
    });\n\
})()\n\
</script>\n$1@i

For example, the above script works fine for a site like MakeUseOf and only partially on a site like this one. Also, for some websites, change is only effective on the border zone.

I also visited this Userscript page, but again with nil result…
Add Thank You Quote this message in a reply
Post Reply 


Messages In This Thread
Website Background Color – Any reliable method to change it? [SOLVED] - Faxopita - Feb. 01, 2016 09:53 PM

Forum Jump: