/
colorido.min.js
1 lines (1 loc) · 2.58 KB
/
colorido.min.js
1
function randInt(t,e){return result=parseInt(Math.random()*(t-e)+e)}function renc(){rand=parseInt(Math.random()*(max-0)+0),mix="random"===config.gradMix?"rgb("+randInt(255,0)+","+randInt(255,0)+","+randInt(255,0)+")":config.gradMix,color=config.choice[rand],conv=color.replace("b","ba"),trans_color=conv.replace(")",","+trans);var t;for(t=0;t<target1.length;t++)target1[t].style.backgroundColor=color,target1[t].style.color="#fff",target1[t].style.transition="background-color"+animD+animT;for(t=0;t<target2.length;t++)target2[t].style.backgroundColor=trans_color,target2[t].style.transition="background-color"+animD+animT;for(t=0;t<target3.length;t++)target3[t].style.color=color,target3[t].style.transition="color"+animD+animT;for(t=0;t<target4.length;t++)target4[t].style.color="#fff",target4[t].style.background="-webkit-radial-gradient("+color+","+mix+")",target4[t].style.background="radial-gradient("+color+", "+mix+")",target4[t].style.transition="all"+animD+animT;for(t=0;t<target5.length;t++)target5[t].style.color="#fff",target5[t].style.background="-webkit-linear-gradient(10grad, "+color+","+mix+")",target5[t].style.background="linear-gradient(10grad, "+color+", "+mix+")",target5[t].style.transition="all"+animD+animT;for(t=0;t<target6.length;t++)target6[t].style.color="#fff",target6[t].style.background="-webkit-linear-gradient(120grad, "+color+","+mix+")",target6[t].style.background="linear-gradient(120grad, "+color+", "+mix+")",target6[t].style.transition="all"+animD+animT;for(t=0;t<target7.length;t++)target7[t].style.color="#fff",target7[t].style.background="-webkit-linear-gradient(500grad, "+color+","+mix+")",target7[t].style.background="linear-gradient(500grad, "+color+", "+mix+")",target7[t].style.transition="all"+animD+animT}function metaIn(t){var e=document.createElement("meta");e.name=t,e.content=config.choice[rand],document.getElementsByTagName("head")[0].appendChild(e)}target1=document.getElementsByClassName("colorido"),target2=document.getElementsByClassName("colorido-o"),target3=document.getElementsByClassName("colorido-t"),target4=document.getElementsByClassName("colorido-gr"),target5=document.getElementsByClassName("colorido-gl"),target6=document.getElementsByClassName("colorido-gd"),target7=document.getElementsByClassName("colorido-gh"),max=config.choice.length,time=1e3*config.autoDuration,trans=1-config.opacity,animD=" "+config.animationDuration+"s ",animT=config.animationType,mix=config.gradMix,config.autoChange?(renc(),setInterval(renc,time)):renc(),config.chromeTab&&(metaIn("theme-color"),metaIn("msapplication-navbutton-color"),metaIn("apple-mobile-web-app-status-bar-style"));