-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
277 lines (236 loc) · 8.49 KB
/
Copy pathindex.html
File metadata and controls
277 lines (236 loc) · 8.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Color Picker Tool | codesaif.in</title>
<meta name="description" content="Try our Color Picker Tool, which lets you easily pick and view colors in Hex, RGB, and HSL formats. Perfect for web designers and developers.">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
font-family: Arial, sans-serif;
background-color: #f8f9fa;
margin-top: 50px;
}
nav {
background-color: #343a40;
padding: 15px;
}
nav a {
color: #ffffff;
font-size: 18px;
padding: 10px 15px;
text-decoration: none;
}
nav a:hover {
color: #28a745;
}
.container {
max-width: 960px;
margin: 0 auto;
}
.section {
padding: 40px 0;
}
h1, h2 {
color: #343a40;
text-align: center;
}
.color-picker-container {
text-align: center;
margin-bottom: 30px;
}
.color-display {
width: 150px;
height: 150px;
margin: 20px auto;
border-radius: 10px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}
.color-codes {
margin: 20px 0;
font-size: 18px;
}
.color-code {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.color-code span {
font-weight: bold;
}
.copy-btn {
background-color: #28a745;
color: white;
border: none;
padding: 5px 15px;
border-radius: 5px;
cursor: pointer;
}
.copy-btn:hover {
background-color: #218838;
}
footer {
background-color: #343a40;
color: white;
text-align: center;
padding: 15px;
margin-top: 50px;
}
footer a {
color: #f8f9fa;
}
footer a:hover {
text-decoration: underline;
}
.article-section {
padding: 60px 0;
text-align: center;
}
.article-section p {
font-size: 1.2rem;
line-height: 1.6;
}
.article-section a {
color: #007bff;
text-decoration: none;
}
.article-section a:hover {
text-decoration: underline;
}
@media (max-width: 767px) {
nav a {
font-size: 16px;
}
.color-display {
width: 120px;
height: 120px;
}
.color-codes {
font-size: 16px;
}
footer {
padding: 10px;
}
}
</style>
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark">
<div class="container">
<a class="navbar-brand" href="#">codesaif.in</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="#home">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#tool">Tool</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#features">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://codesaif.in/tools" target="_blank">Explore More Tools</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Home Section -->
<section id="home" class="section">
<div class="container">
<h1>Color Picker Tool</h1>
<p>Pick colors effortlessly and get the color code in Hex, RGB, and HSL formats for easy use in your web projects.</p>
</div>
</section>
<!-- Color Picker Tool Section -->
<section id="tool" class="section">
<div class="container">
<h2>Try Our Color Picker Tool</h2>
<div class="color-picker-container">
<input type="color" id="colorPicker" value="#3498db" class="form-control form-control-lg">
<div class="color-display" id="colorDisplay"></div>
<div class="color-codes">
<div class="color-code">
<span>Hex:</span>
<span id="hexCode">#3498db</span>
<button class="copy-btn" onclick="copyCode('hexCode')">Copy</button>
</div>
<div class="color-code">
<span>RGB:</span>
<span id="rgbCode">rgb(52, 152, 219)</span>
<button class="copy-btn" onclick="copyCode('rgbCode')">Copy</button>
</div>
<div class="color-code">
<span>HSL:</span>
<span id="hslCode">hsl(204, 69%, 53%)</span>
<button class="copy-btn" onclick="copyCode('hslCode')">Copy</button>
</div>
</div>
</div>
</div>
</section>
<!-- Features Section -->
<section id="features" class="article-section">
<div class="container">
<h2>Why Use Our Color Picker Tool?</h2>
<p>Our Color Picker Tool helps you select and get the color codes quickly. Whether you’re a web designer, developer, or just curious about color codes, this tool is a must-have for your web toolkit.</p>
<p><a href="https://codesaif.in/tools">Explore More Tools</a></p>
</div>
</section>
<!-- Footer Section -->
<footer>
<p>© 2024 codesaif. All Rights Reserved. <br> <a href="https://codesaif.in" target="_blank">Visit Our Website</a></p>
</footer>
<script>
const colorPicker = document.getElementById('colorPicker');
const colorDisplay = document.getElementById('colorDisplay');
const hexCode = document.getElementById('hexCode');
const rgbCode = document.getElementById('rgbCode');
const hslCode = document.getElementById('hslCode');
function updateColors() {
const color = colorPicker.value;
colorDisplay.style.backgroundColor = color;
const hex = color;
const rgb = hexToRgb(hex);
const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);
hexCode.textContent = hex;
rgbCode.textContent = `rgb(${rgb.r}, ${rgb.g}, ${rgb.b})`;
hslCode.textContent = `hsl(${hsl.h}, ${hsl.s}%, ${hsl.l}%)`;
}
function copyCode(id) {
const text = document.getElementById(id).textContent;
navigator.clipboard.writeText(text).then(() => {
alert(`${text} copied to clipboard!`);
});
}
function hexToRgb(hex) {
const r = parseInt(hex.substring(1, 3), 16);
const g = parseInt(hex.substring(3, 5), 16);
const b = parseInt(hex.substring(5, 7), 16);
return { r, g, b };
}
function rgbToHsl(r, g, b) {
r /= 255;
g /= 255;
b /= 255;
const max = Math.max(r, g, b);
const min = Math.min(r, g, b);
const h = (max + min) / 2;
const s = max === min ? 0 : (max - min) / (1 - Math.abs(2 * h - 1));
const l = (max + min) / 2;
return { h: Math.round(h * 360), s: Math.round(s * 100), l: Math.round(l * 100) };
}
colorPicker.addEventListener('input', updateColors);
updateColors();
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>