diff options
author | Mario <mario@mariovavti.com> | 2025-06-05 16:08:22 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2025-06-05 16:08:22 +0000 |
commit | 11b42a371ef0a1ff1517d010fff199093069cc50 (patch) | |
tree | 7e9ac7555c52816a866ff49da481aaf24e6d9bd5 /view/js | |
parent | 61da32dc3ff1406ad5fed552b355037065c47499 (diff) | |
download | volse-hubzilla-11b42a371ef0a1ff1517d010fff199093069cc50.tar.gz volse-hubzilla-11b42a371ef0a1ff1517d010fff199093069cc50.tar.bz2 volse-hubzilla-11b42a371ef0a1ff1517d010fff199093069cc50.zip |
revert to previous color generation logic
Diffstat (limited to 'view/js')
-rw-r--r-- | view/js/main.js | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/view/js/main.js b/view/js/main.js index 598a48ee6..538d0f4c7 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1620,7 +1620,6 @@ const autoExpand = (function () { if (newButtonsFound) { await new Promise(res => setTimeout(res, 700)); iteration++; - } } while (newButtonsFound && iteration < maxIterations); @@ -1655,17 +1654,10 @@ function stringToHexColor(str) { } function stringToHslColor(str) { - let hash = 0; - for (let i = 0; i < str.length; i++) { - hash = str.charCodeAt(i) + ((hash << 5) - hash); - hash |= 0; - } - - const hue = Math.abs(hash) % 360; - const sat = 50 + (Math.abs(hash) % 50); // 50% to 99% - const light = 40 + (Math.abs(hash >> 8) % 40); // 40% to 79% - - return `hsl(${hue}, ${sat}%, ${light}%)`; + let stringUniqueHash = [...str].reduce((acc, char) => { + return char.charCodeAt(0) + ((acc << 5) - acc); + }, 0); + return `hsl(${stringUniqueHash % 360}, 95%, 70%)`; } function dolike(ident, verb) { |