Jump to content

User:Smalemon/randomColor.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//The random color (background-color) simply of color.

//Amounts color

//bits (8 amounts random colors)
document.body.style = `background-color: rgb(${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 2 ) - 0.5 ) + 1 ) * ( 256 / 2 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 2 ) - 0.5 ) + 1 ) * ( 256 / 2 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 2 ) - 0.5 ) + 1 ) * ( 256 / 2 ), 255) ) });`;

//bits (64 amounts random colors)
document.body.style = `background-color: rgb(${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 4 ) - 0.5 ) + 1 ) * ( 256 / 4 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 4 ) - 0.5 ) + 1 ) * ( 256 / 4 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 4 ) - 0.5 ) + 1 ) * ( 256 / 4 ), 255) ) });`;

//bits (512 amounts random colors)
document.body.style = `background-color: rgb(${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 8 ) - 0.5 ) + 1 ) * ( 256 / 8 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 8 ) - 0.5 ) + 1 ) * ( 256 / 8 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 8 ) - 0.5 ) + 1 ) * ( 256 / 8 ), 255) ) });`;

//bits (4,096 amounts random colors)
document.body.style = `background-color: rgb(${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 16 ) - 0.5 ) + 1 ) * ( 256 / 16 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 16 ) - 0.5 ) + 1 ) * ( 256 / 16 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 16 ) - 0.5 ) + 1 ) * ( 256 / 16 ), 255) ) });`;

//bits (32,768 amounts random colors)
document.body.style = `background-color: rgb(${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 32 ) - 0.5 ) + 1 ) * ( 256 / 32 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 32 ) - 0.5 ) + 1 ) * ( 256 / 32 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 32 ) - 0.5 ) + 1 ) * ( 256 / 32 ), 255) ) });`;

//bits (262,144 amounts random colors)
document.body.style = `background-color: rgb(${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 64 ) - 0.5 ) + 1 ) * ( 256 / 64 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 64 ) - 0.5 ) + 1 ) * ( 256 / 64 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 64 ) - 0.5 ) + 1 ) * ( 256 / 64 ), 255) ) });`;

//bits (2,097,152 amounts random colors)
document.body.style = `background-color: rgb(${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 128 ) - 0.5 ) + 1 ) * ( 256 / 128 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 128 ) - 0.5 ) + 1 ) * ( 256 / 128 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 128 ) - 0.5 ) + 1 ) * ( 256 / 128 ), 255) ) });`;

//bits (16,777,216 amounts random colors)
document.body.style = `background-color: rgb(${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 256 ) - 0.5 ) + 1 ) * ( 256 / 256 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 256 ) - 0.5 ) + 1 ) * ( 256 / 256 ), 255) ) },${ Math.floor( Math.min( ( Math.floor( Math.random() * 256 / ( 256 / 256 ) - 0.5 ) + 1 ) * ( 256 / 256 ), 255) ) });`;