Post Reply 
Website Background Color – Any reliable method to change it? [SOLVED]
Feb. 02, 2016, 05:28 PM (This post was last modified: Feb. 02, 2016 05:35 PM by cattleyavns.)
Post: #8
RE: Website Background Color – Any reliable method to change it?
I have a filter like that, but it change only white background to tan background instead of gray or black, I name it "savemyeyes":

Screenshot: http://prntscr.com/9y559s

Code:
FILTER: savemyeyes
s@(^[^;]*?(?:<head[^>]*?>|<body[^>]*?>|<script[^>]*?>[^>]*?</script>))@\n<script>\n\
window.addEventListener("load", Greasemonkey_main, false);\n\
function Greasemonkey_main ()\n\
{\n\
    function getRGBColor(node, prop) {\n\
        var rgb = getComputedStyle(node, null).getPropertyValue(prop);\n\
        var r, g, b;\n\
        if (/rgb\\((\\d+),\\s(\\d+),\\s(\\d+)\\)/.exec(rgb)) {\n\
            r = parseInt(RegExp.\$1, 10);\n\
            g = parseInt(RegExp.\$2, 10);\n\
            b = parseInt(RegExp.\$3, 10);\n\
            return [r / 255, g / 255, b / 255];\n\
        }\n\
        return rgb;\n\
    }\n\
    R(document.documentElement);\n\
window.setInterval(function()\n\
{\n\
    R(document.documentElement);\n\
}, 20000);\n\
\n\
    function R(n) {\n\
        var i, x, color;\n\
        if (n.nodeType == Node.ELEMENT_NODE && n.tagName.toLowerCase() != "input" && n.tagName.toLowerCase() != "select" && n.tagName.toLowerCase != "textarea") {\n\
            for (i = 0; x = n.childNodes[i]; ++i) R(x);\n\
            color = getRGBColor(n, "background-color");\n\
            if ((typeof(color) != "string" && color[0] + color[1] + color[2] >= 2.8) || (n == document.documentElement && color == "transparent")) {\n\
                n.style.backgroundColor = "\#CCCCCC"; /*Moz 1.0*/\n\
                n.style.setProperty("background-color", "tan", "important"); /*Moz 1.4 after zap colors*/\n\
            }\n\
        }\n\
    }\n\
}\n\
</script>\n$1@i

Another version (not as good as the above version, use a transparent and black div instead try to analyze webpage and change white color to tan):

Code:
FILTER: savemyeyes2
s@(^[^;]*?(?:<head[^>]*?>|<body[^>]*?>|<script[^>]*?>[^>]*?</script>))@\n\
<div id="overlay" style="opacity: 0.4; display: block; pointer-events: none;background: none repeat scroll 0% 0% rgb(0, 0, 0);position: fixed;width: 100%;height: 100%;top: 0px;left: 0px;z-index:99999999;"></div>\n\
$1@i

Screenshot: Sorry because I don't have screenshot of this version.
Add Thank You Quote this message in a reply
[-] The following 2 users say Thank You to cattleyavns for this post:
kik0s, Faxopita
Post Reply 


Messages In This Thread
RE: Website Background Color – Any reliable method to change it? - cattleyavns - Feb. 02, 2016 05:28 PM

Forum Jump: