|
@@ -1021,6 +1021,26 @@ function initVarvCcmButtons() {
|
|
|
});
|
|
});
|
|
|
const fit = document.getElementById("varv-ccm-fit");
|
|
const fit = document.getElementById("varv-ccm-fit");
|
|
|
if (fit) fit.addEventListener("click", fitVarvCcm);
|
|
if (fit) fit.addEventListener("click", fitVarvCcm);
|
|
|
|
|
+
|
|
|
|
|
+ const colEl = document.getElementById("varv-ccm-color");
|
|
|
|
|
+ const hexEl = document.getElementById("varv-ccm-hex");
|
|
|
|
|
+ const prevEl = document.getElementById("varv-ccm-preview");
|
|
|
|
|
+ const capEl = document.getElementById("varv-ccm-capture");
|
|
|
|
|
+ const applyColor = (raw) => {
|
|
|
|
|
+ const h = String(raw || "").replace("#", "").trim().toUpperCase();
|
|
|
|
|
+ if (!/^[0-9A-F]{6}$/.test(h)) return;
|
|
|
|
|
+ if (prevEl) prevEl.style.background = "#" + h;
|
|
|
|
|
+ if (colEl) colEl.value = "#" + h.toLowerCase();
|
|
|
|
|
+ if (hexEl) hexEl.value = h;
|
|
|
|
|
+ };
|
|
|
|
|
+ if (colEl) colEl.addEventListener("input", () => applyColor(colEl.value));
|
|
|
|
|
+ if (hexEl) hexEl.addEventListener("change", () => applyColor(hexEl.value));
|
|
|
|
|
+ if (capEl) capEl.addEventListener("click", () => {
|
|
|
|
|
+ const h = (hexEl ? hexEl.value : "").replace("#", "").trim().toUpperCase();
|
|
|
|
|
+ if (!/^[0-9A-F]{6}$/.test(h)) return;
|
|
|
|
|
+ captureVarvRef("c" + h.toLowerCase(), h);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
varvCcmWired = true;
|
|
varvCcmWired = true;
|
|
|
}
|
|
}
|
|
|
|
|
|