-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
112 lines (105 loc) · 3.73 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
<!DOCTYPE html>
<html>
<head>
<title>RGB Control</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background: linear-gradient(270deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff);
background-size: 1400% 1400%;
animation: rainbow 10s ease infinite;
}
h1 {
text-align: center;
color: white;
text-shadow: 2px 2px 4px #000000;
}
.slider-container {
margin-bottom: 20px;
padding: 10px;
background: rgba(255, 255, 255, 0.5); /* Made semi-transparent */
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
input[type="range"] {
width: 100%;
}
#color-preview {
width: 100%;
height: 50px;
margin-top: 20px;
border: 1px solid #ccc;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
@keyframes rainbow {
0% {background-position: 0% 50%;}
50% {background-position: 100% 50%;}
100% {background-position: 0% 50%;}
}
.rainbow-button {
display: block;
margin: 30px auto; /* Added more distance */
padding: 10px 20px;
background-color: #ff7f50;
color: white;
border: none;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}
.rainbow-button:hover {
background-color: #ff6347;
}
</style>
</head>
<body>
<h1>Welcome to RGB-4K++</h1>
<form id="rgb-form">
<div class="slider-container">
R: <input type="range" name="r" min="0" max="255" value="255">
<span id="r-value">255</span>
</div>
<div class="slider-container">
G: <input type="range" name="g" min="0" max="255" value="0">
<span id="g-value">0</span>
</div>
<div class="slider-container">
B: <input type="range" name="b" min="0" max="255" value="0">
<span id="b-value">0</span>
</div>
</form>
<button class="rainbow-button" onclick="location.href=\'/?mode=rainbow\'" >Rainbow Mode</button> <!-- Added button -->
<div id="color-preview"></div>
<script>
function updateColorPreview() {
var r = document.getElementsByName('r')[0].value;
var g = document.getElementsByName('g')[0].value;
var b = document.getElementsByName('b')[0].value;
document.getElementById('r-value').textContent = r;
document.getElementById('g-value').textContent = g;
document.getElementById('b-value').textContent = b;
document.getElementById('color-preview').style.backgroundColor = `rgb(${r},${g},${b})`;
}
function sendColorUpdate() {
var r = document.getElementsByName('r')[0].value;
var g = document.getElementsByName('g')[0].value;
var b = document.getElementsByName('b')[0].value;
fetch(`/?r=${r}&g=${g}&b=${b}`)
.then(response => console.log('Color updated'))
.catch(error => console.error('Error:', error));
}
document.querySelectorAll('input[type="range"]').forEach(slider => {
slider.addEventListener('input', updateColorPreview);
slider.addEventListener('change', sendColorUpdate);
});
// Initial color preview
updateColorPreview();
</script>
</body>
</html>