Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/uxlabspk/colorlab

A Vanilla Java Script based project to create random colors for Web Developers and UI Designers.
https://github.com/uxlabspk/colorlab

colors generator js opensource vanilla-js

Last synced: 28 days ago
JSON representation

A Vanilla Java Script based project to create random colors for Web Developers and UI Designers.

Awesome Lists containing this project

README

        

# colorlab
A Vanilla Java Script based project to create random colors for Web Developers and UI Designers.

# Working
Once you hit on generate button, the JavaScript event listener call a function genCode(). This function generate the six digit code and then append in the cards conatiner div.
``` JavaScript
// function
function genCode() {
var code = "#";

for (let index = 0; index < 6; index++) {
code += getCorresponding(Math.ceil(Math.random() * 10));
}

var style = "background-color: " + code + "; color: #ffffff;";
var templateString = '



' + code + '

';

// inserting cards in the card container.
cardcontainer.innerHTML += templateString;

// creating notification.
var toast = new bootstrap.Toast(toastLiveExample)
toast.show()
}

// function
function getCorresponding(number) {
var num = "";

if (number == 10) num = "A";
else if (number == 11) num = "B";
else if (number == 12) num = "C";
else if (number == 13) num = "D";
else if (number == 14) num = "E";
else if (number == 15) num = "F";
else num = number

return num;
}
```

# Connect with me
prog_naveedprog_naveed