diff --git a/CI-ColorWebs/Pages/Index.cshtml b/CI-ColorWebs/Pages/Index.cshtml index 2fe2567000193a0eadfba3d29104c5a2c219a879..c20ab103f26f4b76c3f7c7c8bd2dea59782b8ce7 100644 --- a/CI-ColorWebs/Pages/Index.cshtml +++ b/CI-ColorWebs/Pages/Index.cshtml @@ -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> diff --git a/CI-ColorWebs/wwwroot/js/site.js b/CI-ColorWebs/wwwroot/js/site.js index 1650af1a72ae6a5f6b07ac296fedc79edc1be47a..a89d137c97cb936cea65efe8dd79b5c147d2dc66 100644 --- a/CI-ColorWebs/wwwroot/js/site.js +++ b/CI-ColorWebs/wwwroot/js/site.js @@ -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);