Somethinghitme

Code, demos and ideas.

Rainbow bright bookmarklet

January 03, 2013

Went a little crazy with a friend of mines bookmarklet he made that would randomly change the colors of all elements on a page.

Gist

Just drag this link to your bookmarks and click it on any random page to enjoy the show

[Rainbow Bright Bookmarklet](javascript:function c(){return Math.floor(255Math.random())}function g(){var a=parseFloat(this.dataset.d);isNaN(a)&&(a=~~(100Math.random()));with(this.style){var d=/rgb((\d{1,3}), (\d{1,3}), (\d{1,3}))/,b=d.exec(color),e={c:c(),b:c(),a:c()},f={c:c(),b:c(),a:c()};null!==b&&(e={c:b[1],b:b[2],a:b[3]});b=d.exec(backgroundColor);null!==b&&(f={c:b[1],b:b[2],a:b[3]});a+=0.5;100<a&&(a=0);cCycle=a+50;100<cCycle&&(cCycle-=100);h(e,cCycle);h(f,a);color=‘rgb(‘+e.c+’,‘+e.b+’,‘+e.a+’)‘;backgroundColor=‘rgb(‘+f.c+’,‘+f.b+’,‘+f.a+’)‘}this.dataset.d=a}function j(){Array.prototype.forEach.call(document.all,function(a){setTimeout(function(){g.call(a)},10)});setTimeout(j,10)}function h(a,d){a.c=(127Math.sin(0.3d+0)+128);a.b=(127Math.sin(0.3d+2)+128);a.a=~~(127Math.sin(0.3d+4)+128)}j())


Written by Jason Brown Father, Veteran, lover of everything tech.