From 18e4ea2ca21eb0e54f9cd49361bd93a32c40e36a Mon Sep 17 00:00:00 2001
From: grembem <aidanleyden@gmail.com>
Date: Sat, 6 May 2023 17:56:39 -0400
Subject: [PATCH] ported the copy to clipboard to true palette

ported over the copy to clipboard feature from the main page to true palette. works identically to the main function.
---
 CI-ColorWebs/Pages/TruePalette.cshtml | 29 +++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/CI-ColorWebs/Pages/TruePalette.cshtml b/CI-ColorWebs/Pages/TruePalette.cshtml
index d512f04..88a51f3 100644
--- a/CI-ColorWebs/Pages/TruePalette.cshtml
+++ b/CI-ColorWebs/Pages/TruePalette.cshtml
@@ -10,6 +10,23 @@
    background-repeat: repeat;
  }
 </style>
+
+<script>
+src = 'truepalette.js'
+function copyHex(celement) { 
+    let hexCopy = celement.innerText;
+    let input = document.createElement('input');
+    input.setAttribute('value', hexCopy);
+    document.body.appendChild(input);
+    input.select();
+
+    document.execCommand('copy');
+    document.body.removeChild(input);
+    alert('Copied: ' + celement.innerText);
+}
+</script>
+
+
 <div class="text-center">
     <h1 class="display-4">Welcome</h1>
     <h2>
@@ -19,12 +36,12 @@
         <span id="palNameTrue" class = "paletteNameTrue"></span>
         <br>
         <br>
-        <button id="palColor"></button>
-        <button id="palColor2"></button>
-        <button id="palColor3"></button>
-        <button id="palColor4"></button>
-        <button id="palColor5"></button>
-        <button id="palColor6"></button>
+        <button id="palColor" onclick="copyHex(palColor)"></button>
+        <button id="palColor2" onclick="copyHex(palColor2)"></button>
+        <button id="palColor3" onclick="copyHex(palColor3)"></button>
+        <button id="palColor4" onclick="copyHex(palColor4)"></button>
+        <button id="palColor5" onclick="copyHex(palColor5)"></button>
+        <button id="palColor6" onclick="copyHex(palColor6)"></button>
         <canvas width = "700"></canvas>
     </h2>
     <h3>
-- 
GitLab