Posted By

resting on 10/11/11


Tagged


Versions (?)

JS Random color generator


 / Published in: JavaScript
 

http://stackoverflow.com/questions/1484506/random-color-generator-in-javascript

  1. function get_random_color() {
  2. var letters = '0123456789ABCDEF'.split('');
  3. var color = '#';
  4. for (var i = 0; i < 6; i++ ) {
  5. color += letters[Math.round(Math.random() * 15)];
  6. }
  7. return color;
  8. }

Report this snippet  

You need to login to post a comment.