apcaTable = {
const table = d3.create("table");
const thead = table.append("thead");
thead
.append("tr")
.selectAll("th")
.data(["", ...colours])
.join("th")
.style("color", (d) => d)
.style("text-shadow", "none")
.style("background", "white")
.text((d) => d);
const tbody = table.append("tbody");
colours.forEach((colour, row) => {
tbody
.append("tr")
.selectAll("td")
.data([colour, ...colours])
.join("td")
.style("text-shadow", "none")
.style("background", colour)
.style("color", (d, i) => (i ? d : "black"))
.text((d, i) =>
i === 0 ? d : i === row + 1 ? "" : apca(d, colour).toFixed(1)
);
});
return table.node();
}