From 457befc8bb97da2c3fef50d7a401c213dc154f62 Mon Sep 17 00:00:00 2001
From: grembem <aidanleyden@gmail.com>
Date: Tue, 18 Apr 2023 23:35:01 -0400
Subject: [PATCH] Name generation framework
added a barebones random name generation and display on the true random page
---
CI-ColorWebs/Pages/Index.cshtml | 4 ++++
CI-ColorWebs/wwwroot/js/site.js | 6 ++++++
2 files changed, 10 insertions(+)
diff --git a/CI-ColorWebs/Pages/Index.cshtml b/CI-ColorWebs/Pages/Index.cshtml
index 2fe2567..c20ab10 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 1650af1..a89d137 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);
--
GitLab