Created
April 24, 2022 11:23
-
-
Save saitergun/e4999da5f4081b984cd1c3357c04bb0c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const string2Hue = (string) => { | |
let hash = 0; | |
for (let i = 0; i < string.length; i += 1) { | |
hash = string.charCodeAt(i) + hash + (hash % 360); | |
} | |
return hash % 360; | |
} | |
export default string2Hue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment