Advertisement
NickWInston123

color preview

Mar 26th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // select color from palette, update onscreen bike and wall colors
  2.  
  3. function color(r, g, b){
  4.  
  5. var iefix;
  6.  
  7. document.commands.output.value = "Choose a bike to display the required console commands";
  8.  
  9. palr = r; palg = g; palb = b;
  10.  
  11. for (i = 1; i <= 7; i++){
  12.  
  13.     biker = r;
  14.     bikeg = g;
  15.     bikeb = b;
  16.  
  17.     wallr1 = r * 14;
  18.     wallg1 = g * 14;
  19.     wallb1 = b * 14;
  20.  
  21.     wallr2 = r * 17;
  22.     wallg2 = g * 17;
  23.     wallb2 = b * 17;
  24.  
  25.     if ((i & 1) > 0){
  26.         wallr1 = 210;
  27.         wallr2 = 255;
  28.         if (biker >= 1){
  29.             wallr1 = 255;
  30.             };
  31.         if (biker == 15){
  32.             biker = 0;
  33.             };
  34.         };
  35.  
  36.     if ((i & 2) > 0){
  37.         wallg1 = 210;
  38.         wallg2 = 255;
  39.         if (bikeg >= 1){
  40.             wallg1 = 255;
  41.             };
  42.         if (bikeg == 15){
  43.             bikeg = 0;
  44.             };
  45.         };
  46.  
  47.     if ((i & 4) > 0){
  48.         wallb1 = 210;
  49.         wallb2 = 255;
  50.         if (bikeb >= 1){
  51.             wallb1 = 255;
  52.             };
  53.         if (bikeb == 15){
  54.             bikeb = 0;
  55.             };
  56.         };
  57.  
  58.     biker *= 17;
  59.     bikeg *= 17;
  60.     bikeb *= 17;
  61.  
  62.     if(navigator.appName != "Microsoft Internet Explorer"){
  63.         // firefox and other compliant browsers
  64.  
  65.         document.getElementById("bike" + i).setAttribute("bgcolor","#" + tohex(biker) + tohex(bikeg) + tohex(bikeb));
  66.         document.getElementById("wall1" + i).setAttribute("bgcolor","#" + tohex(wallr1) + tohex(wallg1) + tohex(wallb1));
  67.         document.getElementById("wall2" + i).setAttribute("bgcolor","#" + tohex(wallr2) + tohex(wallg2) + tohex(wallb2));
  68.         }
  69.     else{
  70.         // internet explorer :(
  71.  
  72.         iefix = eval("document.all.bike" + i + ".style");
  73.         iefix.backgroundColor="#" + tohex(biker) + tohex(bikeg) + tohex(bikeb);
  74.         iefix = eval("document.all.wall1" + i + ".style");
  75.         iefix.backgroundColor="#" + tohex(wallr1) + tohex(wallg1) + tohex(wallb1);
  76.         iefix = eval("document.all.wall2" + i + ".style");
  77.         iefix.backgroundColor="#" + tohex(wallr2) + tohex(wallg2) + tohex(wallb2);
  78.         }
  79.  
  80.     }
  81.  
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement