Cycymomo
7/29/2013 - 10:02 AM

140bytes - invert color http://www.developpez.net/forums/d1362763/webmasters-developpement-web/javascript/ludique-defis-code-en-tweet/

// 140bytes - http://www.developpez.net/forums/d1362763/webmasters-developpement-web/javascript/ludique-defis-code-en-tweet/
// 179
(function invertColor(){
for(i=0;e=document.all[i++];)['backgroundColor','color'].map(function(p){(d=getComputedStyle(e)[p])!='rgba(0, 0, 0, 0)'&&(e.style[p]=d.replace(/\d+/g,function(n){return 255-n}))})
})()

/* test : change rules CSS / 170
(function negatifPage(){
for(i=0;e=document.styleSheets[i++];)for(j=0;r=e.rules[j++];)['backgroundColor','color'].map(function(p){r.style[p]=r.style[p].replace(/\d+/g,function(n){return 255-n})})
}())
*/
// 140bytes - http://www.developpez.net/forums/d1362763/webmasters-developpement-web/javascript/ludique-defis-code-en-tweet/
/* Chrome : */
(function(){
document.styleSheets[0].addRule('html','-webkit-filter:invert()')
})()

/* IE9+ & Opera : */
(function(){
document.styleSheets[0].addRule("body:before","content:'';position:fixed;outline:2999px solid invert")
})()