Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/uxlabspk/colorlab
- Owner: uxlabspk
- Created: 2023-07-21T07:10:47.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-07-21T07:24:38.000Z (over 1 year ago)
- Last Synced: 2023-07-21T08:37:16.312Z (over 1 year ago)
- Topics: colors, generator, js, opensource, vanilla-js
- Language: HTML
- Homepage: https://uxlabspk.github.io/colorlab/
- Size: 367 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 = numberreturn num;
}
```# Connect with me
prog_naveed