I can’t remember the inspiration for this crazy thing, but I’m sure somewhere out there someone is looking for a random colour generator that is done in jQuery.
So if you’re feeling in the mood to have a randomly changing colour … this is the script for you! Essentially it’s just generating a random number between 0 and 255 for red, green, and blue. It then uses CSS to change the colour property of an element (that’s easily customizable by you).
good one yaar!!!!
great !
erational did something similar but the colors are animated:
http://www.erational.org/randomColor.html
Great!
But do you know how we can make a random with only 20 colors?
20 colours randomly generated at once should be very straightforward. Create a function that generates a random colour and returns its value, call it 20 times in a loop.
is this not easier ?
function randomColor(){
return ‘#’+Math.floor(Math.random()*16777216).toString(16);
}
Yup, looks easier.