mirror of
https://github.com/Dvorinka/SEEN.git
synced 2026-06-04 20:43:03 +00:00
small fix, don't worry about it
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
export type ArtworkTone = 'neutral' | 'accent' | 'secondary'
|
||||
|
||||
const hashSeed = (seed: string): number => {
|
||||
let hash = 0
|
||||
for (let index = 0; index < seed.length; index += 1) {
|
||||
hash = (hash << 5) - hash + seed.charCodeAt(index)
|
||||
hash |= 0
|
||||
}
|
||||
return Math.abs(hash)
|
||||
}
|
||||
|
||||
const artworkTones: ArtworkTone[] = ['neutral', 'accent', 'secondary']
|
||||
|
||||
export const artworkTone = (seed: string): ArtworkTone =>
|
||||
artworkTones[hashSeed(seed) % artworkTones.length] ?? 'neutral'
|
||||
Reference in New Issue
Block a user