|
@@ -155,6 +155,8 @@ const onColorChange = (inputValue, skipUpdates = false) => {
|
|
|
color: ${contrast};
|
|
|
background-color: ${hex};
|
|
|
`;
|
|
|
+ newColor.setAttribute("role", "button");
|
|
|
+ newColor.addEventListener("click", () => onColorChange(hex));
|
|
|
selectors.prevColors.prepend(newColor);
|
|
|
|
|
|
selectors.background = hex;
|
|
@@ -349,6 +351,7 @@ const makePokemonTile = (name) => {
|
|
|
|
|
|
const mu = clone.querySelector(".pkmn-total");
|
|
|
mu.appendChild(document.createTextNode(total.muHex));
|
|
|
+ mu.addEventListener("click", () => onColorChange(total.muHex));
|
|
|
mu.style = `
|
|
|
color: ${getContrastingTextColor(total.muHex)};
|
|
|
background-color: ${total.muHex};
|
|
@@ -360,6 +363,7 @@ const makePokemonTile = (name) => {
|
|
|
|
|
|
clusters.forEach((cls, i) => {
|
|
|
const clsDiv = clone.querySelector(`.pkmn-cls${i + 1}`);
|
|
|
+ clsDiv.addEventListener("click", () => onColorChange(cls.muHex));
|
|
|
clsDiv.querySelector("span:first-child").innerText =
|
|
|
(cls.proportion * 100).toFixed(2) + "%";
|
|
|
clsDiv.querySelector("span:nth-child(2)").innerText = cls.muHex;
|
|
@@ -433,14 +437,5 @@ window.addEventListener("load", () => {
|
|
|
document.forms.clusterMetric.elements.statistic.value = "importance";
|
|
|
onMetricChange(document.forms.clusterMetric.elements, true);
|
|
|
|
|
|
- document.body.addEventListener("click", ({ target: { innerText }, detail }) => {
|
|
|
- if (detail === 2 && innerText?.includes("#")) {
|
|
|
- const clickedHex = innerText?.match(/.*(#[0-9a-fA-F]{6}).*/)?.[1] ?? "";
|
|
|
- if (clickedHex) {
|
|
|
- onColorChange(clickedHex);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
onColorChange(randomColor());
|
|
|
});
|