summaryrefslogtreecommitdiff
path: root/web/index.html
diff options
context:
space:
mode:
authordaniel-Jones <daniel@danieljon.es>2017-06-04 16:26:56 +0930
committerdaniel-Jones <daniel@danieljon.es>2017-06-04 16:26:56 +0930
commitf66536d84b38aa0eb46e928fdaf13d7da790b2ee (patch)
treeba2624354136f3f0db3ec929d1eea15635527ba1 /web/index.html
parent2ce2f6376152402c3fc0d750720770b963a7d3cf (diff)
downloadRGB-Controller-f66536d84b38aa0eb46e928fdaf13d7da790b2ee.tar.gz
RGB-Controller-f66536d84b38aa0eb46e928fdaf13d7da790b2ee.zip
added HTML/JS/PHP pages/scripts to allow RGB changes over a web page. Integrated a server into the application to allow incoming connections and receive commands
Diffstat (limited to 'web/index.html')
-rw-r--r--web/index.html28
1 files changed, 28 insertions, 0 deletions
diff --git a/web/index.html b/web/index.html
new file mode 100644
index 0000000..2d22fb1
--- /dev/null
+++ b/web/index.html
@@ -0,0 +1,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>