Skip to content

Instantly share code, notes, and snippets.

@thachhoang
Last active December 11, 2015 05:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thachhoang/4554465 to your computer and use it in GitHub Desktop.
Save thachhoang/4554465 to your computer and use it in GitHub Desktop.
Random hex color code generator.
var color='#'+(Math.random()*0xFFFFFF<<0).toString(16);
// by nlogax
// http://paulirish.com/2009/random-hex-color-code-snippets/
bg_colour = Math.floor(Math.random()*16777215).toString(16)
bg_colour = "#"+("000000" + bg_colour).slice(-6)
document.bgColor = bg_colour
// Matt Malin (matt@randomcolour.com)
// http://randomcolour.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment