Last active
December 15, 2015 12:29
-
-
Save JesseBuesking/5260743 to your computer and use it in GitHub Desktop.
Inverts browser colors. I've in-lined a stripped-down version of rgbcolor.js and minified the entire script. For reference, checkout http://stackoverflow.com/a/4766232/435460
This file contains 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
javascript:var c=[{r:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,p:function(b){return[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]}},{r:/^(\w{2})(\w{2})(\w{2})$/,p:function(b){return[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],16)]}},{r:/^(\w{1})(\w{1})(\w{1})$/,p:function(b){return[parseInt(b[1]+b[1],16),parseInt(b[2]+b[2],16),parseInt(b[3]+b[3],16)]}}];function w(b){this.ok=!1;"#"==b.charAt(0)&&(b=b.substr(1,6));b=b.replace(/ /g,"").toLowerCase();for(a=0;a<c.length;a++){var d=c[a].r.exec(b);d&&(z=c[a].p(d),this.r=z[0],this.g=z[1],this.b=z[2],this.ok=!0)}this.r=0>this.r||isNaN(this.r)?0:255<this.r?255:this.r;this.g=0>this.g||isNaN(this.g)?0:255<this.g?255:this.g;this.b=0>this.b||isNaN(this.b)?0:255<this.b?255:this.b}function y(){var b=["color","background-color"];$($("*").get().reverse()).each(function(){var d=null,e;for(e in b)e=b[e],$(this).css(e)&&(d=new w($(this).css(e)),d.ok&&$(this).css(e,"rgb("+(255-d.r)+","+(255-d.g)+","+(255-d.b)+")"))})}function z(b,d){var e=document.createElement("script");e.src=b;e.onload=d;document.getElementsByTagName("head")[0].appendChild(e)}window.jQuery?y():z("https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js",y); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment