vsupalov


Generate a random HTML grey value

October 29, 2011 [ javascript | old ]

Similar to theĀ randomColor function, but only for shades of grey:

function randomGrey() {
  var s = "#";
  var grey = randomRange(0,15).toString(16);

  while(s.length < 7) {
    s+=grey;
  }

  return s;
}

I really wish js had more built-in string methods.

Want to be notified when I publish new content?

Just enter your name and email below. You will also get content that I share exclusively with the list, and zero spam!