Add color order
This commit is contained in:
parent
42e92dafc8
commit
b7920e224f
|
@ -76,6 +76,7 @@ class Settings(dict):
|
||||||
elif key == "color_order":
|
elif key == "color_order":
|
||||||
if value == "rbg": self.color_order = (1, 5, 3)
|
if value == "rbg": self.color_order = (1, 5, 3)
|
||||||
else: self.color_order = (1, 3, 5)
|
else: self.color_order = (1, 3, 5)
|
||||||
|
pass
|
||||||
elif key == "id":
|
elif key == "id":
|
||||||
pass
|
pass
|
||||||
elif key == "led_pin":
|
elif key == "led_pin":
|
||||||
|
|
|
@ -98,3 +98,12 @@ input[type="range"]::-moz-range-thumb {
|
||||||
#connection-status.closed {
|
#connection-status.closed {
|
||||||
background-color: red;
|
background-color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#color_order_form label,
|
||||||
|
#color_order_form input[type="radio"] {
|
||||||
|
/* Ensures they behave as inline elements */
|
||||||
|
display: inline-block;
|
||||||
|
/* Adds some space between them for readability */
|
||||||
|
margin-right: 10px;
|
||||||
|
vertical-align: middle; /* Aligns them nicely if heights vary */
|
||||||
|
}
|
||||||
|
|
|
@ -162,6 +162,18 @@ async function updateLedPin(event) {
|
||||||
sendWebSocketData({ led_pin: parseInt(ledpin) });
|
sendWebSocketData({ led_pin: parseInt(ledpin) });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleRadioChange(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
console.log("Selected color order:", event.target.value);
|
||||||
|
// Add your specific logic here
|
||||||
|
if (event.target.value === "rgb") {
|
||||||
|
console.log("RGB order selected!");
|
||||||
|
} else if (event.target.value === "rbg") {
|
||||||
|
console.log("RBG order selected!");
|
||||||
|
}
|
||||||
|
sendWebSocketData({ color_order: event.target.value });
|
||||||
|
}
|
||||||
|
|
||||||
function createPatternButtons(patterns) {
|
function createPatternButtons(patterns) {
|
||||||
const container = document.getElementById("pattern_buttons");
|
const container = document.getElementById("pattern_buttons");
|
||||||
container.innerHTML = ""; // Clear previous buttons
|
container.innerHTML = ""; // Clear previous buttons
|
||||||
|
@ -205,6 +217,8 @@ document.addEventListener("DOMContentLoaded", async function () {
|
||||||
.getElementById("brightness")
|
.getElementById("brightness")
|
||||||
.addEventListener("touchend", updateBrightness);
|
.addEventListener("touchend", updateBrightness);
|
||||||
|
|
||||||
|
document.getElementById("rgb").addEventListener("change", handleRadioChange);
|
||||||
|
document.getElementById("rbg").addEventListener("change", handleRadioChange);
|
||||||
document.querySelectorAll(".pattern_button").forEach((button) => {
|
document.querySelectorAll(".pattern_button").forEach((button) => {
|
||||||
console.log(button.value);
|
console.log(button.value);
|
||||||
button.addEventListener("click", async (event) => {
|
button.addEventListener("click", async (event) => {
|
||||||
|
|
|
@ -110,6 +110,13 @@
|
||||||
/>
|
/>
|
||||||
<input type="submit" value="Update Led Pin" />
|
<input type="submit" value="Update Led Pin" />
|
||||||
</form>
|
</form>
|
||||||
|
<form id="color_order_form">
|
||||||
|
<label for="rgb">RGB:</label>
|
||||||
|
<input type="radio" id="rgb" name="color_order" value="rgb" {{'checked' if settings["color_order"]=="rgb" else ''}} />
|
||||||
|
<label for="rbg">RBG</label>
|
||||||
|
<input type="radio" id="rbg" name="color_order" value="rbg" {{'checked' if settings["color_order"]=="rbg" else ''}}/>
|
||||||
|
</form>
|
||||||
|
|
||||||
<p>Mac address: {{mac}}</p>
|
<p>Mac address: {{mac}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="connection-status"></div>
|
<div id="connection-status"></div>
|
||||||
|
|
Loading…
Reference in New Issue