forked from tinkerhub/tink-her-hack-temp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcapsule.html
More file actions
99 lines (83 loc) · 2.94 KB
/
capsule.html
File metadata and controls
99 lines (83 loc) · 2.94 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Customizable Capsules in Box</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 0;
padding: 20px;
background-color: #f0f0f0;
}
.box {
border: 2px solid #333; /* Box border */
padding: 20px;
background-color: #fff; /* Box background */
display: inline-block;
margin-top: 20px;
}
.shape {
margin: 0 auto;
display: block;
position: relative;
}
.capsule {
width: 250px;
height: 80px;
border-radius: 40px; /* Rounded ends create the capsule shape */
}
.split-capsule {
background: linear-gradient(to right, #009688 50%, #FF5722 50%); /* Split gradient */
}
.solid-capsule {
background-color: #009688; /* Solid color */
}
.customizer {
margin-top: 10px;
}
label {
margin-right: 10px;
}
</style>
</head>
<body>
<h1> Capsules </h1>
<!-- Container Box for both capsules -->
<div class="box">
<!-- Split Capsule Shape -->
<div class="shape capsule split-capsule" id="splitCapsule"></div>
<p>Split Capsule</p>
<div class="customizer">
<label for="capsuleColor1">Change Left Color: </label>
<input type="color" id="capsuleColor1" value="#009688" onchange="changeSplitColor()">
<br>
<label for="capsuleColor2">Change Right Color: </label>
<input type="color" id="capsuleColor2" value="#FF5722" onchange="changeSplitColor()">
</div>
<br>
<!-- Solid Capsule Shape -->
<div class="shape capsule solid-capsule" id="solidCapsule"></div>
<p>Solid Capsule</p>
<div class="customizer">
<label for="solidCapsuleColor">Change Solid Capsule Color: </label>
<input type="color" id="solidCapsuleColor" value="#009688" onchange="changeSolidColor()">
</div>
</div>
<script>
// Function to change the colors of the split capsule shape
function changeSplitColor() {
const color1 = document.getElementById('capsuleColor1').value;
const color2 = document.getElementById('capsuleColor2').value;
document.getElementById('splitCapsule').style.background = linear-gradient(to right, ${color1} 50%, ${color2} 50%);
}
// Function to change the color of the solid capsule shape
function changeSolidColor() {
const color = document.getElementById('solidCapsuleColor').value;
document.getElementById('solidCapsule').style.backgroundColor = color;
}
</script>
</body>
</html>