Add fallback avatar and guild icons #41
1 changed files with 4 additions and 6 deletions
|
@ -5,11 +5,9 @@ let h64: CallableFunction;
|
||||||
h64 = (await xxhash()).h64;
|
h64 = (await xxhash()).h64;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
export default (seed: string): string => {
|
export default (seed: string, saturation: number = 100, lightness: number = 50): string => {
|
||||||
const lightness = 50
|
const idHash = useState(`h64Hash-${seed}`, () => h64(seed))
|
||||||
|
const hashValue: bigint = idHash.value
|
||||||
// this should probably be cached eventually
|
|
||||||
const idHash = h64(seed)
|
|
||||||
|
|
||||||
return `hsl(${idHash % 360n}, 100%, ${lightness}%)`
|
return `hsl(${hashValue % 360n}, ${saturation}%, ${lightness}%)`
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue