Last active
December 20, 2015 08:49
-
-
Save Cycymomo/6103320 to your computer and use it in GitHub Desktop.
140bytes - invert color http://www.developpez.net/forums/d1362763/webmasters-developpement-web/javascript/ludique-defis-code-en-tweet/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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") | |
})() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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