|
kambo (m)
|
what does this script do? --------------------------------
suppose to help u make better color choices by generating a 2 random colors , rendering text in color#1 and background in color #2. and vice versa . also rendering sample texts in both random colors also.
okay, its not photoshopand i aint no pro coder gat a 1 mnth of javascript practice,but is it useful?, or u still thinking red,blue,yellow ,green - like i was before hacking this together. ---------------------------------------------------------------------------------------------------- here's the code code block: save as dot html ".html e.g colorscript.html' color are generated randomly,and the colors' hex codes also are rendered. copy code within the <html></html> tags. --------------------------------------------------------------------------------------------------------------- <html> <head> <script> // autogenerated hash colors var range= new Array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','f') var hash ="#"; var col = function(){ var scope = range.length-1; var start=0; rndm = function(){ var hashc =""; for(x=0;x<6;x++){ var make = Math.floor(Math.random()*scope+start); hashc += range[make]; } return hashc; } var mxc = rndm(); return hash+mxc; } /////////////////////////////////// end of autocolor method/// function testc(){
var t = document.getElementById("para"); var xl = document.getElementById("tall"); var reps = document.getElementById("tall"); var bgbx = document.getElementById("bgk"); var tbx = document.getElementById("txtk"); var look = col(); var bgc = col(); t.innerHTML="<b style='background-color:"+look+";font-size:20px;color:"+bgc+"'>"+"Background Color= 'LL' . textcolor= 'AA' </b>";
xl.innerHTML="<BR><h2 style='background-color:"+bgc+";font-size:30px;color:"+look+";'><pre>BGC = AA "+ "TEXT = LL</PRE>"+ "code</h2>" // combine color and display var stn = document.getElementById("stn1"); stn.innerHTML ="<br><h3 style='color:"+look+";font-size:24px;'>TEXT I: LL"+ "</h3>"; var terd = document.getElementById("again"); terd.innerHTML="<b style='font-size:21px;color:"+bgc+";'>TEXT II :AA</b>"; //set tbx . bgbx code tbx.value=look; bgbx.value = bgc; }
</script> </head> <body> <fieldset> <hr> <b style="font-size:37px;background-color:yellow;color:black;"><center>cOLOR mIx , :</center></b> <hr> </fieldset>
<p id="para"> </P> <fieldset> <p><h2 id="tall"><hr> ITS ALL ABOUT COLOR!!</h2> <b id="stn1">stand alone text :</b>
<code id="again"> SAMPLE TEXT </code>
</p> <hr> <p> <button onclick="testc()">change color</button></p> </fieldset> <p><center> <h3><strong> <u> HEX CODE :</u></strong></h3><b><font size="6">'AA:':</font></b> <input type = "text" id="bgk" value="" size="15" readonly=""></center></p> <p><center> <code><bold>HEX CODE.:</bold></code><P> <b><font size="6">'LL:' :</font></b><input type ="text" id="txtk" value="" size="15" readonly=""></p></center></p>
</body> </html> <!-------stop copyhere------->
|