Your Blog Post
<!DOCTYPE html>
<html lang="en">
<head>
<title>Color Picker</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f8f8f8;
margin: 0;
align-items: center;
justify-content: center;
flex-direction: column;
}
#colorPicker {
width: 330px;
height: 330px;
margin-bottom: 20px;
}
#selectedColor {
font-size: 16px;
color: #333;
display: flex;
flex-direction: column;
align-items: center;
}
#hexContainer {
margin-bottom: 10px;
}
#hexCode {
margin-right: 10px;
}
#copyButton {
cursor: pointer;
color: #0723eb;
text-decoration: none;
border: 1px solid #0723eb;
padding: 5px 10px;
border-radius: 5px;
transition: background-color 0.3s;
}
#copyButton:hover {
background-color:#0723eb;
color: #fff;
}
/* Hide the link */
a[href="https://www.tectuner.com/"] {
display: none;
}
</style>
</head>
<body>
<input id="colorPicker" onchange="updateColor()" type="color" />
<div id="selectedColor">
<div id="hexContainer">
<span id="hexCode">#000000</span>
<a id="copyButton" onclick="copyToClipboard()">Copy</a>
</div>
</div>
<script>
function updateColor() {
var colorPicker = document.getElementById('colorPicker');
var hexCode = document.getElementById('hexCode');
// Get the selected color value
var color = colorPicker.value;
// Update the text content of the hexCode span
hexCode.textContent = color;
}
function copyToClipboard() {
var hexCode = document.getElementById('hexCode');
// Create a temporary input element
var tempInput = document.createElement('input');
tempInput.value = hexCode.textContent;
document.body.appendChild(tempInput);
// Select the text in the input element
tempInput.select();
tempInput.setSelectionRange(0, 99999); /* For mobile devices */
// Copy the text to the clipboard
document.execCommand('copy');
// Remove the temporary input element
document.body.removeChild(tempInput);
}
</script>
</body>
</html>