-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
536 lines (472 loc) · 29.1 KB
/
index.html
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" itemprop="description"
content="Unlock the beauty of your photos with our palette creation tool! Transform your images into stunning color palettes effortlessly. Try our photo-to-palette generator now.">
<meta name="keywords" itemprop="keywords"
content="color palette from image, image to palette, photo color extraction, color palette generator, extract colors from pictures">
<meta property="og:title" content="Extract palette from image - Color Alchemy">
<meta property="og:description"
content="Unlock the beauty of your photos with our palette creation tool! Transform your images into stunning color palettes effortlessly. Try our photo-to-palette generator now.">
<meta property="og:image" content="https://raw.githubusercontent.com/njirolu/color-alchemy/main/logo.png">
<meta property="og:image:width" content="500">
<meta property="og:image:height" content="500">
<meta property="og:site_name" content="njirolu.github.io">
<meta property="og:url" content="https://njirolu.github.io/color-alchemy">
<meta property="og:type" content="website">
<title>Color Alchemy</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"
integrity="sha512-NhSC1YmyruXifcj/KFRWoC561YpHpc5Jtzgvbuzx5VozKpWvQ+4nXhPdFgmx8xqexRcpAglTj9sIBWINXa8x5w=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="icon" type="image/png" href="https://raw.githubusercontent.com/njirolu/color-alchemy/main/logo.png">
<style>
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
min-height: 100vh;
font-family: 'Inter';
font-style: normal;
margin: 0;
display: flex;
flex-direction: column;
position: relative;
}
header {
-webkit-backdrop-filter: blur(8px) brightness(1) contrast(1) grayscale(0) hue-rotate(0deg) invert(0) opacity(1) saturate(1) sepia(0);
backdrop-filter: blur(8px) brightness(1) contrast(1) grayscale(0) hue-rotate(0deg) invert(0) opacity(1) saturate(1) sepia(0);
width: 100%;
z-index: 50;
top: 0;
position: sticky;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #e5e7eb;
}
nav {
align-items: center;
width: 100%;
display: flex;
margin-left: auto;
margin-right: auto;
height: 3.5rem;
}
nav .nav-container {
display: flex;
flex-direction: row;
align-items: center;
margin-right: 1rem;
}
.logo {
align-items: center;
display: flex;
color: inherit;
text-decoration: none;
cursor: pointer;
}
.logo-text {
margin-top: 8px;
font-weight: bold;
}
@media (min-width: 768px) {
nav {
max-width: 1400px;
}
nav .nav-container {
display: flex;
}
.page-title h1 {
font-size: 42px;
color: #000000;
margin: 0;
}
.page-title p {
font-size: 1.25rem;
color: #52525b;
line-height: 1.5;
max-width: 60rem;
margin: 0;
}
main section.page-container {
padding-top: 2.5rem;
padding-bottom: 3rem;
}
}
main {
background-color: transparent;
flex: 1 1 0%;
}
.big-image {
width: 100%;
display: flex;
justify-content: center;
margin-bottom: 30px;
}
.big-image svg {
max-width: 360px;
max-height: 360px;
}
main section.page-container {
padding-top: 2.5rem;
padding-bottom: 2rem;
padding-left: 0.35rem;
padding-right: 0.35rem;
}
main .page-title {
text-align: center;
flex-direction: column;
gap: 1rem;
align-items: center;
max-width: 64rem;
width: 100%;
display: flex;
margin-left: auto;
margin-right: auto;
}
.page-title h1 {
font-size: 28px;
color: #000000;
margin: 0;
}
.page-title p {
font-size: 1rem;
color: #52525b;
line-height: 1.5;
max-width: 60rem;
margin: 0;
}
section.image-palatte-container {
width: 100%;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
#drop-area {
padding: 20px;
text-align: center;
}
#drop-area.active {
border: 2px dashed #e6e6e6;
border-radius: 8px;
}
.drop-text {
display: flex;
flex-direction: column;
}
.drop-text h1 {
margin-bottom: 4px;
font-size: 20px;
font-weight: 600;
color: #7f7f7f;
}
.drop-text span {
font-size: 16px;
color: #7f7f7f;
font-weight: 400;
margin-bottom: 4px;
}
.drop-text label {
font-size: 16px;
color: #333333;
font-weight: 400;
text-decoration: underline;
cursor: pointer;
}
#preview {
max-width: 100%;
max-height: 300px;
display: none;
}
#colorPalette {
display: flex;
flex-wrap: wrap;
gap: 10px;
padding-top: 20px;
padding-bottom: 80px;
justify-content: center;
}
.color-palette .color-box {
width: 100px;
height: 100px;
border: 2px solid #fff;
cursor: pointer;
position: relative;
border-radius: 10px;
}
.color-box:hover::before {
content: attr(data-color);
position: absolute;
top: -30px;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.7);
color: #fff;
padding: 2px 6px;
border-radius: 4px;
font-size: 12px;
opacity: 0;
transition: opacity 0.3s;
pointer-events: none;
}
.color-box:hover::after {
content: "Copy";
color: #e5e7eb;
position: absolute;
left: 35px;
top: 45%;
font-size: 12px;
font-weight: 700;
font-family: 'Inter';
opacity: 0;
transition: opacity 0.3s;
pointer-events: none;
}
.color-box:hover::before,
.color-box:hover::after {
opacity: 1;
}
footer {
background-color: #333333;
padding: 10px;
text-align: center;
}
footer p {
color: #e5e7eb;
margin: 0;
}
</style>
</head>
<body>
<header>
<nav>
<div class="nav-container">
<a class="logo" href="#">
<img src="https://raw.githubusercontent.com/njirolu/color-alchemy/main/logo.png" height="42" width="42" />
</a>
<span class="logo-text">Color Alchemy</span>
</div>
</nav>
</header>
<main>
<section class="page-container">
<div class="big-image">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 524.92557 493.29296">
<g>
<path
d="M407.32079,104.89971l8.22992,3.89856c-3.37555-4.71082-6.28418-12.06805-7.84137-17.92249-2.63654,5.45343-6.88672,12.1261-11.09375,16.11194l8.69812-2.23767c-5.35974,26.26794-25.5191,45.12573-48.60437,45.12573l-.32679,.9488c24.11316,0,45.46577-18.59639,50.93824-45.92488Z"
fill="#3f3d56" />
<path
d="M382.44158,64.87575h52c2.20557,0,4,1.79443,4,4,0,2.20557-1.79443,4-4,4h-52c-2.20557,0-4-1.79443-4-4,0-2.20557,1.79443-4,4-4Z"
fill="#3f3d56" />
</g>
<path id="uuid-0273e7bd-2c5c-4a7f-b62c-18eea742226e-64"
d="M264.92279,154.72124c6.20006-5.12306,13.86909-6.07666,17.12879-2.13037,3.2597,3.9463,.87559,11.29697-5.32737,16.42103-2.44975,2.08084-5.3622,3.54476-8.49369,4.26925l-26.54405,21.37487-9.7651-12.67015,27.20447-19.72667c1.30258-2.93957,3.29036-5.52436,5.79694-7.53798Z"
fill="#ffb6b6" />
<path
d="M111.50119,202.94868c-.01345-.94525-.00459-9.19091,6.09985-14.40256,7.01233-5.98673,16.9071-3.56355,20.3776-2.71366,8.01693,1.96329,8.67442,5.40237,16.20317,8.93598,14.08546,6.61103-3.5631,3.22722,4.81818,1.10732,2.90113-.73379,44.63804-3.62833,55.02716-10.02263,20.20554-12.43611,33.97284-19.97737,33.97284-19.97737l9,18s-13.01399,18.09572-31.33009,31.5013c-18.78816,13.75105-28.18224,20.62664-42.4587,23.28316-1.22942,.22878-31.46585,5.39136-55.81886-12.80293-5.55484-4.15004-15.73256-11.7539-15.89116-22.9086Z"
fill="#e6e6e6" />
<g>
<circle cx="284.19977" cy="158.33361" r="25.13289" fill="#000000" opacity=".2" />
<circle cx="308.3457" cy="169.52001" r="25.13289" fill="#fff" />
<circle cx="308.3457" cy="169.52001" r="25.13289" fill="#000000" opacity=".5" />
<circle cx="333.83306" cy="181.32788" r="25.13289" fill="#fff" />
<circle cx="333.83306" cy="181.32788" r="25.13289" fill="#000000" opacity=".8" />
<circle cx="356.63755" cy="191.89281" r="25.13289" fill="#000000" />
</g>
<g>
<path
d="M166.20778,211.49749c-1.33478-2.25069-7.10919,.15916-8.1708-1.88344-1.05785-2.03522,4.30724-5.13625,7.37242-12.2203,.55281-1.27751,4.03609-9.32803,1.45742-11.81214-4.88783-4.7086-27.25471,14.7226-35.08209,8.36378-1.71786-1.39548-2.91794-4.18131-8.11695-8.70435-2.06832-1.79935-3.31896-2.61176-4.52936-2.3095-1.71747,.42886-1.85353,2.72746-3.69518,7.24698-2.76191,6.77793-4.39543,6.36865-6.00464,11.77634-1.19458,4.01438-.9217,6.34829-2.3274,6.80297-1.98919,.64346-3.82014-3.61452-6.34111-3.23327-2.57249,.38911-4.12776,5.3468-4.619,9.05872-.92189,6.9657,1.63622,11.56213,3.05409,16.39529,1.54079,5.25243,2.45525,13.24023-1.10301,24.5481l-35.21877,99.22915c7.77523-20.36152,30.2882-76.17789,39.74814-96.91965,2.73093-5.9877,5.74623-12.06109,11.93758-14.45806,5.96083-2.30781,14.14726-.92995,24.58399-3.44425,1.21889-.29358,4.60134-1.1542,5.02707-3.14368,.352-1.64476-1.63758-2.56284-1.33189-4.1033,.41-2.06629,4.32248-2.09167,9.13042-4.47557,3.39027-1.68105,5.50239-3.68018,7.31867-5.39939,.5476-.51831,8.68742-8.31833,6.91051-11.31443h-.0001Z"
fill="#f2f2f2" />
<path
d="M27.64662,263.73586c-1.4898,.00569-1.97308,3.53515-3.28191,3.46683-1.30415-.06803-1.27814-3.59599-3.87061-7.14441-.46751-.63989-3.41371-4.67241-5.377-4.12347-3.72128,1.04038-.63791,17.62471-6.01732,19.63175-1.18054,.44049-2.89415,.2257-6.61413,1.47238-1.47991,.49597-2.2395,.87538-2.44039,1.55667-.28504,.96666,.80383,1.69673,2.49067,3.90457,2.52975,3.31119,1.85753,3.99489,4.04733,6.34497,1.62561,1.74459,2.84986,2.28408,2.66739,3.10518-.25812,1.16196-2.87625,.83206-3.41651,2.17933-.55126,1.37487,1.43325,3.56863,3.11333,4.88074,3.15285,2.4623,6.14687,2.53298,8.92812,3.23163,3.02249,.75925,7.20684,2.61519,11.73012,7.62431l38.54058,45.91638c-7.75019-9.69109-28.64951-36.8454-36.10019-47.47309-2.15087-3.06798-4.26169-6.30029-3.65171-10.03069,.58721-3.5915,3.62552-7.21185,5.40281-13.05974,.2076-.68297,.76113-2.5914-.09244-3.37439-.7057-.64732-1.73035,.06431-2.39823-.53023-.89584-.79746,.22058-2.72505,.43774-5.77262,.15313-2.14899-.21865-3.76244-.53838-5.14995-.0964-.4183-1.57611-6.66392-3.55927-6.6563v.00014Z"
fill="#f2f2f2" />
<path
d="M57.36759,270.40755l-.89757-8.01245,.41009-.60742c1.89767-2.8088,2.86491-5.55184,2.87649-8.1556,.00193-.41395-.01742-.82795-.03676-1.24963-.07739-1.67135-.17407-3.74893,.9092-6.17084,.60742-1.35022,2.3136-4.47629,4.87866-4.0894,.6906,.09673,1.21291,.41395,1.60945,.78535,.05804-.09283,.11801-.1857,.18184-.28629,.79891-1.2187,1.43147-1.74097,2.04082-2.24393,.46813-.38689,.95175-.78535,1.71004-1.72939,.33271-.41395,.59193-.77763,.81054-1.08327,.66353-.92464,1.53013-2.02731,3.05833-2.00796,1.63265,.07739,2.48767,1.42761,3.05447,2.32132,1.01172,1.59396,1.47016,2.74304,1.77387,3.50519,.11029,.27857,.23602,.59193,.29985,.68867,.52617,.77377,4.80326,.05027,6.41458-.21281,3.61934-.60356,6.7512-1.12583,8.0415,1.1568,.92469,1.63265,.23795,3.79148-2.10277,6.58871-.72929,.87051-1.50499,1.53206-2.19366,2.05052,.57066,.34047,1.0813,.86274,1.28837,1.68298h0c.48748,1.94215-1.18194,3.88822-4.95991,5.79173-.9382,.47585-2.20138,1.11039-3.97139,1.41603-.83374,.14315-1.58431,.17798-2.22652,.19733-.01356,.3714-.10059,.77377-.32692,1.18773-.66353,1.2187-2.04468,1.79901-4.12617,1.65972-2.2904-.11994-4.17644-.5571-5.84007-.94013-1.45274-.33271-2.70435-.61514-3.68703-.54938-1.82221,.14701-3.22666,1.60559-4.87476,3.49747l-4.11454,4.809h-.00005Z"
fill="#f2f2f2" />
<path
d="M61.53129,222.70138l-7.52275,2.90057-.69156-.24263c-3.19829-1.12317-6.09693-1.36301-8.61848-.71376-.40093,.10315-.79645,.22685-1.19945,.35254-1.59705,.49877-3.58219,1.11931-6.19965,.68577-1.46017-.24504-4.91673-1.10252-5.19313-3.68182-.08158-.69253,.09278-1.27824,.35147-1.75602-.10455-.03257-.20958-.06701-.32306-.10325-1.38148-.4637-2.04714-.94307-2.68823-1.40493-.49298-.35471-1.00111-.72143-2.10658-1.21547-.48483-.21682-.90235-.37531-1.25344-.50924-1.06272-.40725-2.34911-.96589-2.718-2.44903-.33927-1.59888,.74994-2.76842,1.47064-3.5434,1.28523-1.38293,2.28041-2.11787,2.94061-2.60496,.24147-.17731,.51271-.37844,.5901-.46471,.615-.70522-1.16968-4.6589-1.83288-6.15082-1.50186-3.34786-2.80147-6.24481-.92073-8.07189,1.34472-1.30854,3.60713-1.19188,6.9066,.36276,1.02702,.48463,1.86371,1.06716,2.53988,1.60182,.18459-.63835,.56024-1.26482,1.30115-1.67308h0c1.75501-.96415,4.06084,.15704,6.86038,3.32861,.69827,.7868,1.63246,1.84774,2.37705,3.48232,.34993,.77016,.57399,1.48734,.75563,2.10368,.36272-.0811,.77397-.09895,1.23182,.01496,1.34713,.33271,2.25884,1.52149,2.65205,3.57023,.46495,2.24591,.52048,4.18117,.57196,5.88754,.04665,1.48965,.0909,2.77194,.40382,3.7058,.60443,1.72534,2.3715,2.71385,4.61958,3.8282l5.69538,2.76017-.00019,.00005Z"
fill="#f2f2f2" />
<path
d="M57.36759,199.09645l-.89757-8.01245,.41009-.60742c1.89767-2.8088,2.86491-5.55184,2.87649-8.1556,.00193-.41395-.01742-.82795-.03676-1.24963-.07739-1.67135-.17407-3.74893,.9092-6.17084,.60742-1.35022,2.3136-4.47629,4.87866-4.0894,.6906,.09673,1.21291,.41395,1.60945,.78535,.05804-.09283,.11801-.1857,.18184-.28629,.79891-1.2187,1.43147-1.74097,2.04082-2.24393,.46813-.38689,.95175-.78535,1.71004-1.72939,.33271-.41395,.59193-.77763,.81054-1.08327,.66353-.92464,1.53013-2.02731,3.05833-2.00796,1.63265,.07739,2.48767,1.42761,3.05447,2.32132,1.01172,1.59396,1.47016,2.74304,1.77387,3.50519,.11029,.27857,.23602,.59193,.29985,.68867,.52617,.77377,4.80326,.05027,6.41458-.21281,3.61934-.60356,6.7512-1.12583,8.0415,1.1568,.92469,1.63265,.23795,3.79148-2.10277,6.58871-.72929,.87051-1.50499,1.53206-2.19366,2.05052,.57066,.34047,1.0813,.86274,1.28837,1.68298h0c.48748,1.94215-1.18194,3.88822-4.95991,5.79173-.9382,.47585-2.20138,1.11039-3.97139,1.41603-.83374,.14315-1.58431,.17798-2.22652,.19733-.01356,.3714-.10059,.77377-.32692,1.18773-.66353,1.2187-2.04468,1.79901-4.12617,1.65972-2.2904-.11994-4.17644-.5571-5.84007-.94013-1.45274-.33271-2.70435-.61514-3.68703-.54938-1.82221,.14701-3.22666,1.60559-4.87476,3.49747l-4.11454,4.809h-.00005Z"
fill="#f2f2f2" />
<path
d="M65.56574,354.6252l-1.67912-1.05235-.40623-1.93829,.40623,1.93829-1.95764,.22439c-.03097-.18184-.13736-.5997-.29787-1.25353-.8763-3.58258-3.54774-14.48508-5.77624-31.65511-1.55532-11.98578-2.43547-24.30812-2.61731-36.63051-.18184-12.34169,.40237-21.68506,.87051-29.1945,.35398-5.66402,.78347-11.05723,1.20514-16.3112,1.12197-14.03629,2.1801-27.2949,1.39277-41.9734-.17407-3.27694-.53973-10.09775-4.52463-17.35578-2.31167-4.20934-5.49573-7.94665-9.4652-11.10364l2.46833-3.10282c4.38149,3.4897,7.90409,7.62943,10.47113,12.30304,4.41825,8.04724,4.81676,15.47939,5.00825,19.05034,.80084,14.93773-.26888,28.32404-1.40247,42.49571-.41786,5.23458-.8473,10.60458-1.19935,16.24539-.46427,7.43987-1.04265,16.7019-.86274,28.885,.17798,12.17534,1.04844,24.34681,2.58248,36.18172,2.20138,16.95341,4.83418,27.69342,5.69885,31.22181,.46041,1.88416,.5571,2.27877,.08511,3.02548v-.00005Z"
fill="#f2f2f2" />
<path
d="M35.45041,174.61426c-.16249,0-.32692-.00386-.49327-.01549-3.37367-.18184-6.49776-2.20138-9.28722-6.00063-1.30767-1.78743-1.97699-3.82632-3.31177-7.89251-.20698-.62677-1.21291-3.80697-1.82419-8.18267-.40044-2.85912-.35012-4.05457,.21667-5.11078,.6287-1.17615,1.64621-1.99633,2.79139-2.54957-.05027-.37917-.0097-.76991,.15477-1.16843,.67511-1.652,2.47026-1.43533,3.44136-1.33087,.49134,.0619,1.10455,.14315,1.76615,.10831,1.04072-.05027,1.5998-.35982,2.44705-.82409,.81054-.44493,1.81835-.99817,3.3137-1.30381,2.94809-.61514,5.41835,.22053,6.23274,.4952,4.28475,1.42761,6.39717,4.75872,8.84229,8.61597,.48748,.77377,2.16076,3.5903,3.26531,7.45145,.79698,2.7856,.68481,4.02364,.44493,4.94442-.48748,1.89188-1.63844,2.97516-4.5614,5.36614-3.05254,2.50316-4.5846,3.7567-5.90004,4.51884-3.06219,1.76808-4.98505,2.87842-7.53848,2.87842v.0001Z"
fill="#f2f2f2" />
</g>
<path
d="M.25553,352.88599c0,.66003,.53003,1.19,1.19006,1.19H523.73557c.65997,0,1.19-.52997,1.19-1.19,0-.65997-.53003-1.19-1.19-1.19H1.44559c-.66003,0-1.19006,.53003-1.19006,1.19Z"
fill="#ccc" />
<circle cx="139.41963" cy="125.8183" r="31.35231" fill="#ffb6b6" />
<g>
<polygon
points="384.95929 336.45544 352.6707 303.40431 336.00309 320.79057 360.05926 352.48074 383.92063 355.2098 384.95929 336.45544"
fill="#ffb6b6" />
<path
d="M200.59018,274.47704c1.88857,.15692,7.89007,1.35928,13.62641-1.79676,3.91484-2.15387,5.92265-5.35646,6.60076-6.37492,8.41291-12.63529,40.70354-32.3386,69.68363-33.55112,6.56277-.27457,10.88253,.48586,14.80888,2.53252,5.56743,2.90211,7.79007,7.05924,14.85498,16.79751,3.86456,5.32688,8.14065,10.34531,12.05176,15.6381,22.89761,30.98673,31.57809,33.41933,30.69089,43.35349-.98437,11.02209-12.87155,21.47919-20.77229,20.27203-3.23557-.49436-4.48861-2.74421-8.8115-7.29884-12.67503-13.35438-17.91904-10.88716-26.94319-21.11588-10.53585-11.94223-9.15661-21.84423-14.65344-22.2267-5.09746-.35467-7.26369,8.09257-18.14632,19.31415-4.97964,5.13476-8.52567,7.49028-19.32879,14.98488-42.06982,29.18579-42.74126,31.23684-51.23141,33.56451-3.71461,1.01839-30.07911,8.24653-39.47092-3.25614-14.69706-18.00039,20.02356-72.2507,37.04055-70.83684Z"
fill="#2f2e41" />
<path
d="M375.0879,343.92421c2.3747-1.06633,5.15137-2.31312,6.04472-5.1803,.60449-1.94008,.25639-4.33223-.99307-5.98523-1.44165-1.90726-3.57548-2.15863-3.48915-2.49608,.13145-.51383,5.17729-.31297,10.71634,1.64505,1.04526,.36949,5.78059,2.09976,11.80411,6.8023,4.82606,3.76768,4.17661,4.52299,7.2029,6.69545,9.28962,6.66861,18.00248,1.41287,23.02914,7.66672,1.93996,2.41361,2.76736,5.84038,1.95095,8.6112-1.63952,5.56439-9.61248,7.47928-13.96999,8.46791-10.49443,2.381-18.43771,.43726-26.73198-.96036-28.2074-4.75317-44.05602-.42414-46.17728-6.95898-.40147-1.2368,.25076-1.13149,2.42568-10.20766,2.1466-8.95807,2.07617-11.41819,3.90438-12.13555,2.75194-1.0798,4.59974,3.832,11.53217,5.51299,6.14328,1.48961,11.21238-.78653,12.75108-1.47746Z"
fill="#2f2e41" />
</g>
<g>
<polygon
points="327.55546 444.57835 319.39767 399.0989 295.843 404.12569 297.95309 443.85621 316.16474 459.51343 327.55546 444.57835"
fill="#ffb6b6" />
<path
d="M209.80218,289.76408c1.47458,1.19034,5.76537,5.55531,12.28414,6.16501,4.44882,.41611,7.90855-1.10642,9.04156-1.56836,14.05646-5.73092,51.83954-3.90205,76.50003,11.36805,5.58456,3.45805,8.73193,6.51298,10.83152,10.41128,2.97713,5.52767,2.48188,10.2156,2.85934,22.24075,.20649,6.57783,.92671,13.13152,1.19087,19.70728,1.54645,38.49787,7.36313,45.38515,1.05061,53.10699-7.00383,8.56748-22.71196,10.54513-28.57157,5.1097-2.39968-2.22596-2.17313-4.79123-3.19252-10.98742-2.98899-18.1676-8.71359-19.0708-10.43682-32.60197-2.01189-15.79789,4.6897-23.21682,.35612-26.61997-4.01874-3.15588-10.55463,2.61738-25.86082,5.79169-7.00377,1.45251-11.26065,1.41036-24.4082,1.54542-51.19964,.52605-52.90697,1.84615-61.23923-.99535-3.64552-1.24322-29.51974-10.06694-30.83182-24.85869-2.05321-23.14739,57.13999-48.53996,70.42679-37.81438Z"
fill="#2f2e41" />
<path
d="M315.19338,445.21524c2.56373,.45115,5.56141,.97869,7.91065-.89211,1.58961-1.26588,2.64486-3.44073,2.53921-5.51013-.1219-2.38771-1.74638-3.79393-1.48546-4.02467,.3973-.35135,4.4597,2.64827,7.9435,7.37882,.65742,.89268,3.60406,4.98347,5.94759,12.25702,1.87764,5.82758,.91611,6.08788,2.2003,9.58486,3.94203,10.73442,14.1028,11.27815,14.75035,19.27556,.24989,3.0865-.98973,6.3866-3.2212,8.22088-4.48123,3.68361-12.15376,.79097-16.31454-.83789-10.02065-3.92285-15.50185-9.99165-21.58014-15.80566-20.67117-19.77252-36.21605-25.09006-34.30173-31.68848,.36231-1.24884,.84286-.79544,7.73911-7.08423,6.8065-6.20697,8.12967-8.28215,10.04525-7.84912,2.88345,.65183,1.65425,5.75372,6.44656,11.03747,4.24679,4.68226,9.71937,5.64536,11.38055,5.93768Z"
fill="#2f2e41" />
</g>
<path
d="M143.69405,131.81197c1.22056-4.36611-.31249-5.95722,1.25006-7.91705,.00003-.00005,.62879-.78866,6.25031-2.91681h0c-1.65858-9.62327-.41671-11.2505-.41669-11.25055,1.43127-1.8754,4.29841-2.32876,6.25031-2.08344,4.12819,.51888,4.85892,4.25059,7.50037,4.16687,3.64894-.11567,8.0254-7.4199,6.66699-13.75067-1.1081-5.16413-5.88596-8.99921-7.08368-8.33374-1.18752,.65982-5.46243-2.24971-7.08368-1.66675-1.10718,.39812-6.31869-.13154-7.50037,.41669-1.29047,.59873-4.98615,4.32638-5.33949,3.85669-2.45539-3.26381-2.4031-4.40334-3.82763-5.10676-2.52423-1.24645-5.26853,1.05738-10.00049,3.3335-9.73614,4.68315-12.58703,1.88959-17.08417,5.83362-2.27174,1.99234-3.48993,5.8-5.83362,13.33398-3.27762,10.5362-4.91642,15.8043-3.3335,20.83435,1.61431,5.12975,3.99156,4.01326,7.50037,11.25055,3.90586,8.05632,2.55966,12.73907,6.25031,14.58405,2.85239,1.42595,7.43638,.51842,9.16711-2.08344,2.96322-4.45461-4.69577-10.48055-2.08344-17.50085,1.60355-4.30934,6.55023-7.57687,9.5838-6.66699,3.43004,1.0288,3.68263,7.17885,5.83362,7.08368,1.84195-.08149,3.1208-4.65609,3.3335-5.41693Z"
fill="#2f2e41" />
<path
d="M119.94289,161.81343c6.41582-7.1937,32.54884,.25199,35.00171,11.66724,1.00888,4.69526-2.71559,6.67778-1.66675,12.08392,1.53407,7.90724,10.22012,7.36822,16.66748,15.41742,9.1533,11.42746-.27645,22.59815,10.00049,41.6687,2.19602,4.07511,4.04696,7.50978,7.91705,10.83386,8.88079,7.62783,17.14571,5.01184,21.66772,12.08392,3.38161,5.2886,1.99221,11.80701,1.66675,13.33398-1.33457,6.26124-4.95164,7.78684-7.50037,12.9173-4.24047,8.53583,.56076,14.80261,.83337,25.00122,.3411,12.76028-6.43985,30.44826-20.00098,36.25177-15.2353,6.51999-33.61034-4.27862-42.50207-15.00073-5.30577-6.39802-6.84594-12.29974-9.16711-19.58429-10.37389-32.55642-16.23462-29.61194-24.16785-55.41937-9.06912-29.50258-10.852-64.06639,0-75.00366,1.43839-1.44971,5.39684-4.80045,7.91705-10.83386,3.39128-8.11878,.46152-12.19725,3.3335-15.41742Z"
fill="#e6e6e6" />
<path
d="M323.70885,189.63567c1.57726,10.35715-5.56582,20.06666-15.92297,21.64391-10.35715,1.57726-20.06666-5.56582-21.64391-15.92297-1.57726-10.35715,5.56582-20.06666,15.92297-21.64391,10.35715-1.57726,20.06666,5.56582,21.64391,15.92297Zm-35.58968,5.41984c1.41127,9.26718,10.09843,15.65814,19.36561,14.24687s15.65814-10.09843,14.24687-19.36561-10.09843-15.65814-19.36561-14.24687-15.65814,10.09843-14.24687,19.36561Z"
fill="#3f3d56" />
<path
d="M295.19548,193.97789c.81705,5.36521,5.84646,9.06524,11.21167,8.24819s9.06524-5.84646,8.24819-11.21167c-.81705-5.36521-5.84646-9.06524-11.21167-8.24819-5.36521,.81705-9.06524,5.84646-8.24819,11.21167Z"
fill="#3f3d56" />
<path
d="M380.75654,32.78589c2.36542,15.53268,16.92593,26.24454,32.45861,23.87912,15.53268-2.36542,26.24454-16.92593,23.87912-32.45861-2.36542-15.53268-16.92593-26.24454-32.45861-23.87912-15.53268,2.36542-26.24454,16.92593-23.87912,32.45861Z"
fill="#000000" />
<path id="uuid-d43be532-fa37-4a43-8eed-58df037ae9c1-65"
d="M274.47227,187.7154c7.83621-1.8112,15.12263,.76395,16.27447,5.75115,1.15184,4.9872-4.26667,10.49685-12.10592,12.30764-3.12153,.76629-6.38119,.7739-9.50625,.02216l-33.29924,7.25482-2.83532-13.17542,32.91716-8.00874c2.47923-2.04725,5.41278-3.47085,8.5551-4.15161Z"
fill="#ffb6b6" />
<path
d="M115.42164,196.83576c.20624-.92258,2.1281-8.94114,9.27521-12.59414,8.21006-4.19627,17.27253,.45666,20.45112,2.08862,7.34259,3.76988,7.18417,7.26766,13.68755,12.45173,12.16708,9.69886,27.81373,9.4865,36.45816,9.36916,2.99222-.04061,12.23328-.34603,23.82254-4.15523,22.53966-7.40841,36.93915-16.70515,36.93915-16.70515l5.91628,20.04609s-17.45414,19.28887-38.38087,28.07871c-21.46607,9.01634-82.69082,9.6114-97.19405,8.88286-1.24895-.06272,18.63365,1.85636-.83311-21.49202-4.44031-5.32567-12.57593-15.08355-10.14197-25.97062Z"
fill="#e6e6e6" />
</svg>
</div>
<div class="page-title">
<h1>
The easiest path to craft vibrant color schemes
</h1>
<p>
Effortless color palettes with Median-cut magic. Perfect for artists, designers, and decorators. Unleash
your
inner color maestro today!
</p>
</div>
</section>
<section class="image-palatte-container">
<div id="drop-area">
<img id="preview" src="#" alt="Preview">
<div class="drop-text">
<h1>Drop your image here!</h1>
<span>Or</span>
<label for="file-input">Choose Image</label>
</div>
<input type="file" id="file-input" accept="image/*" hidden>
</div>
<canvas id="canvas" style="display: none;"></canvas>
<div id="colorPalette" class="color-palette"></div>
</section>
</main>
<footer>
<p>© 2023 Color Alchemy</p>
</footer>
<script src="https://cdn.jsdelivr.net/npm/mediancut@2.1.0/lib/mediancut.min.js"></script>
<script>
const dropArea = document.getElementById('drop-area');
const fileInput = document.getElementById('file-input');
const previewImage = document.getElementById('preview');
const canvas = document.getElementById('canvas');
const colorPaletteDiv = document.getElementById('colorPalette');
const k = 10;
dropArea.addEventListener('dragover', (e) => {
e.preventDefault();
dropArea.classList.add('active');
});
dropArea.addEventListener('dragleave', () => {
dropArea.classList.remove('active');
});
dropArea.addEventListener('drop', (e) => {
e.preventDefault();
dropArea.classList.remove('active');
const file = e.dataTransfer.files[0];
if (file && file.type.startsWith('image/')) {
const reader = new FileReader();
reader.onload = function () {
previewImage.src = reader.result;
previewImage.style.display = 'block';
};
reader.readAsDataURL(file);
extractColorPalette(file);
}
});
fileInput.addEventListener('change', () => {
const file = fileInput.files[0];
if (file && file.type.startsWith('image/')) {
const reader = new FileReader();
reader.onload = function () {
previewImage.src = reader.result;
previewImage.style.display = 'block';
};
reader.readAsDataURL(file);
extractColorPalette(file);
}
});
document.getElementById('imageInput').addEventListener('change', (event) => {
const file = event.target.files[0];
if (file) {
extractColorPalette(file);
}
});
function extractColorPalette(file) {
const reader = new FileReader();
reader.onload = (e) => {
const img = new Image();
img.src = e.target.result;
img.onload = () => {
canvas.width = img.width;
canvas.height = img.height;
const ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);
const imageData = ctx.getImageData(0, 0, img.width, img.height);
let medianCut = new MedianCut(imageData);
medianCut.reduce(10);
const paletteColors = medianCut.palette.map(center => {
const color = rgbToHex(center[0], center[1], center[2])
return color;
});
colorPaletteDiv.innerHTML = '';
for (const color of paletteColors) {
const colorBox = document.createElement('div');
colorBox.style.backgroundColor = color;
colorBox.className = 'color-box';
colorBox.dataset.color = color;
colorBox.addEventListener('click', () => copyToClipboard(color));
colorPaletteDiv.appendChild(colorBox);
}
};
};
reader.readAsDataURL(file);
}
function copyToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
}
function rgbToHex(r, g, b) {
return `#${((1 << 24) | (r << 16) | (g << 8) | b).toString(16).slice(1).toUpperCase()}`;
}
</script>
</body>
</html>