Merge branch 'irc-colours' into fallback-server-icons

This commit is contained in:
Twig 2025-07-14 19:51:12 +02:00
commit bbc822604f
No known key found for this signature in database
6 changed files with 29 additions and 2 deletions

15
utils/generateIrcColor.ts Normal file
View file

@ -0,0 +1,15 @@
import xxhash from "xxhash-wasm"
let h64: CallableFunction;
(async () => {
h64 = (await xxhash()).h64;
})();
export default (seed: string): string => {
const lightness = 50
// this should probably be cached eventually
const idHash = h64(seed)
return `hsl(${idHash % 360n}, 100%, ${lightness}%)`
}