Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

generate random color

function getRandomColor() {
    const availableCharacters = '0123456789ABCDEF';
    const availableCharacterLength = availableCharacters.length;

    let color = '#';

    for (let i = 0; i < 6; i++) {
      color += availableCharacters[Math.floor(Math.random() * availableCharacterLength)];
    }

    return color;
}

console.log(getRandomColor()); // #3BB46D
Comment

Random color

function getRandomColor() {
    const availableCharacters = '0123456789ABCDEF';
    const availableCharacterLength = availableCharacters.length;

    let color = '#';

    for (let i = 0; i < 6; i++) {
        color += availableCharacters[Math.floor(Math.random() * availableCharacterLength)];
    }

    return color;
}
Comment

random color generator

function randomColor(e){return '#'+Math.round(Math.random()*0xffffff).toString(16);}

randomColor(/*idk*/)
Comment

PREVIOUS NEXT
Code Example
Javascript :: bind method in javascript 
Javascript :: send params in nested screen 
Javascript :: Convert mnemonic to seed in javascript 
Javascript :: how to seperate header body and footer in node 
Javascript :: how can i do metaname csrf token attrcontent in vanilla javascrip 
Javascript :: setting live reload sublime text 3 
Javascript :: Play and Pause media for HTML5 using JS/Javascript 
Javascript :: multiply js 
Javascript :: for item loop 
Javascript :: vue 3 
Javascript :: console.table in javascript 
Javascript :: function inside a class component react 
Javascript :: check if user is streaming discord js 
Javascript :: javascript index of biggest number 
Javascript :: import objectdoesnotexist 
Javascript :: document.getelementsbyclassname equivalent in jquery 
Javascript :: remove btn 
Javascript :: get character length javascript 
Javascript :: set radgrid datasource clientside 
Javascript :: jquery slider get value on change 
Javascript :: react use media query 
Javascript :: shorthand if in javascript with return 
Javascript :: Highest and Lowest 
Javascript :: install svelte router 
Javascript :: discord.js bot presence 
Javascript :: js get target foreach 
Javascript :: write an array that invokes the alter function in to the array 
Javascript :: vuejs input call the value 
Javascript :: remote with post data jquery ajax example 
Javascript :: vscode angular: running ngcc 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =