Adding directories of uploaded files, if they are missing.

This commit is contained in:
Roland 2025-01-06 16:46:53 -07:00
parent a9fbf7b384
commit a363b18734
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
7 changed files with 66 additions and 9 deletions

View file

@ -1920,11 +1920,13 @@ export function getDistinctColor(hexColors) {
function isDistinct(newColor, existingColors, threshold) {
const hslNew = newColor;
for (let color of existingColors) {
let hslColor = hexToHSL(color);
if (Math.abs(hslNew.h - hslColor.h) < threshold &&
Math.abs(hslNew.s * 100 - hslColor.s * 100) < threshold &&
Math.abs(hslNew.l - hslColor.l * 100) < threshold) {
for (const color of existingColors) {
const hslColor = hexToHSL(color);
const h = Math.abs(hslNew.h - hslColor.h);
const s = Math.abs(hslNew.s * 100 - hslColor.s * 100);
const l = Math.abs(hslNew.l - hslColor.l * 100);
if (h < threshold && s < threshold && l < threshold) {
console.debug(`trying distinct color h=${h} s=${s} l=${l} with threshold=${threshold}`);
return false;
}
}