Skip to content
Snippets Groups Projects
Commit 457befc8 authored by grembem's avatar grembem
Browse files

Name generation framework

added a barebones random name generation and display on the true random page
parent b3500558
Branches
No related tags found
No related merge requests found
......@@ -16,6 +16,10 @@
<h2>
<button id="genNew">Generate New Random Color</button>
<br>
<br>
<span id="palName"></span>
<br>
<br>
<span id="color"></span>
<span id="color2"></span>
<span id="color3"></span>
......
......@@ -6,10 +6,16 @@ const canvas = document.querySelector("canvas");
const context = canvas.getContext("2d");
const cre = () => {
var ranColor = [];
const namesFirst = ["Beautiful ", "Splash of ", "Colorful ", "Dreary ", "Radiant " ,"Vibrant ", "Awe Struck "];
const namesLast = ["Morning", "Color", "Dreams", "Inspiration", "Wonder", "Midnight", "Hue"];
const genNameFirst = namesFirst[Math.floor(Math.random() * 7)];
const genNameLast = namesLast[Math.floor(Math.random() * 7)];
for (var i = 0; i <= 5; i++){
const randomColor = "000000".replace(/0/g,function(){return (~~(Math.random()*16)).toString(16);});
ranColor.push(randomColor)
}
palName.innerHTML = "\""+genNameFirst + genNameLast+"\"";
document.getElementById("palName").style.fontSize = "xx-large";
color.innerHTML = "#" + ranColor[0];
context.fillStyle = '#' +ranColor[0];
context.fillRect(0, 0, 116, 150);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment