diff --git a/CI-ColorWebs/Pages/TruePalette.cshtml b/CI-ColorWebs/Pages/TruePalette.cshtml index d512f04d6b2283ce37a95fa84fd77922542087a1..88a51f363b7365e3a5cbe1fdf3010e873e1d198d 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>