<h1>Color Picker</h1>

<label for="colorPicker">Choose a color:</label>
<input type="color" value="#e0ffee" id="colorPicker">

<b>Current color code: <code id="colorCode"></code></b>
/*Just fancy stuff!!*/

body {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}

h1 {
	font-size: 3rem;
	color: black;
	font-family: "Berkshire Swash", cursive;
	text-align: center;
}

input[type="color"] {
    background-color: #fff;
    padding: 10px;
    width: 200px;
    height: 30px;
    cursor: pointer;
    border: 2px solid #000;
    border-radius: 3px;
    margin: 20px;
}

b {
	background-color: #fff;
	padding: 16px;
	font-family: sans-serif;
}

code {
	font-size: 1.2rem;
	background-color: lightslategray;
	color: #fff;
	border-radius: 3px;
	padding: 5px;
}
// Just fancy stuff!! 
//Added only for accepting the color input and changing body background
const body = document.querySelector("body");
const input = document.getElementById("colorPicker");
const colorCode = document.getElementById("colorCode");

setColor();
input.addEventListener("input", setColor);

function setColor() {
	body.style.backgroundColor = input.value;
	colorCode.innerHTML = input.value;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.