blob: 2d22fb15366b2b32ad07e4aec4cfca92dd61e14c (
plain)
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
|
<html>
<head>
<title>RGB Controler</title>
</head>
<body>
<script type="text/javascript">
function hexToRgb(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
}
function pick_colour() {
var http = new XMLHttpRequest();
var url = "sendcmd.php";
rgb_o = hexToRgb(document.getElementById("colour").value);
var params = "r="+rgb_o.r+"&g="+rgb_o.g+"&b="+rgb_o.b;
http.open("GET", url + "?" + params, true);
http.send();
}
</script>
<form id="colour_picker" onsubmit="pick_colour(); return false;" action="#">
<input type="color" name="colour" id="colour" value="#ff0000">
<input type="submit">
</form>
</body>
|