Skip to content

Commit 6bafe94

Browse files
committed
pick color
1 parent 0996d40 commit 6bafe94

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

pick-color/index.html

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<title>Color Picker App</title>
7+
<style>
8+
body {
9+
font-family: system-ui, Arial;
10+
text-align: center;
11+
background-color: #f5f5f5;
12+
margin-top: 100px;
13+
transition: background-color 0.5s;
14+
}
15+
16+
.picker-container {
17+
display: inline-block;
18+
background: #fff;
19+
padding: 25px 30px;
20+
border-radius: 12px;
21+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
22+
}
23+
24+
h2 {
25+
margin-bottom: 15px;
26+
}
27+
28+
input[type="color"] {
29+
border: none;
30+
width: 80px;
31+
height: 50px;
32+
cursor: pointer;
33+
}
34+
35+
#hexValue {
36+
margin-top: 10px;
37+
font-size: 18px;
38+
font-weight: 600;
39+
}
40+
</style>
41+
</head>
42+
43+
<body>
44+
<div class="picker-container">
45+
<h2>🎨 Pick a Color</h2>
46+
<input type="color" id="colorPicker" value="#00bcd4">
47+
<p id="hexValue">#00BCD4</p>
48+
</div>
49+
50+
<script>
51+
const picker = document.getElementById("colorPicker");
52+
const hexValue = document.getElementById("hexValue");
53+
54+
picker.addEventListener("input", () => {
55+
document.body.style.backgroundColor = picker.value;
56+
hexValue.textContent = picker.value.toUpperCase();
57+
hexValue.style.color = picker.value;
58+
});
59+
</script>
60+
</body>
61+
62+
</html>

0 commit comments

Comments
 (0)