Skip to content

Instantly share code, notes, and snippets.

@Cycymomo
Last active December 20, 2015 08:49
Show Gist options
  • Save Cycymomo/6103320 to your computer and use it in GitHub Desktop.
Save Cycymomo/6103320 to your computer and use it in GitHub Desktop.
// 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")
})()
// 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})})
}())
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment