createPaletteVisVertical = (colorsArray = [], backgroundColor = "white") => {
const size = SWATCH_SIZE + SWATCH_STROKE * 2;
const paletteListItem = (index) => {
const colorOklch = colorsArray[index];
return htl.html`<li class="palette-swatch">
<svg viewBox="0 0 ${size} ${size}" style="max-height:120px;">
${createSwatch(getCssColorString(colorOklch), "#ccc")}
</svg>
<div>
${dl(index)}
</div>
</li>`;
};
const dl = (index) => {
const colorOklch = colorsArray[index];
const props = ["lightness", "chroma", "hue"];
return htl.html`<dl>${colorOklch.coords.map((value, index) =>
dtdd(props[index], value)
)}</dl>`;
};
const dtdd = (key, value) => htl.html`<div>
<dt>${key}:</dt>
<dd>${value?.toFixed(2)}</dd>
</div>`;
const container = htl.html`<div class="palette-vis-vert-container">
<style>
.palette-vis-vert-container {
padding: 16px;
font-family: sans-serif;
}
.palette-swatch {
display: flex;
align-items: center;
gap: 8px;
max-height: 120px;
}
dl {
margin: 0;
padding: 0;
display: flex;
align-items: baseline;
gap: 8px;
font-family: monospace;
}
dl div {
display: flex;
align-items: baseline;
gap: 4px;
}
dl div:not(:last-of-type)::after {
content: "|"
}
dd,
dt {
margin: 0;
}
dd {
font-weight: bold;
}
</style>
${colorsArray.map((oklch, index) => paletteListItem(index))}
</div>`;
return container;
}