Merge branch 'irc-colours' into fallback-server-icons
This commit is contained in:
commit
bbc822604f
6 changed files with 29 additions and 2 deletions
15
utils/generateIrcColor.ts
Normal file
15
utils/generateIrcColor.ts
Normal 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}%)`
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue