diff options
Diffstat (limited to 'client/utils/generate_gruvbox.js')
-rw-r--r-- | client/utils/generate_gruvbox.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/client/utils/generate_gruvbox.js b/client/utils/generate_gruvbox.js new file mode 100644 index 0000000..033d893 --- /dev/null +++ b/client/utils/generate_gruvbox.js @@ -0,0 +1,19 @@ +// This is also from https://github.com/USUFSLC/sochat +const gruvboxColors = [ + '#b8bb26', + '#fabd2f', + '#83a598', + '#d3869b', + '#8ec07c', + '#458588', + '#cc241d', + '#d65d0e', + '#bdae93', +]; + +export const generateGruvboxFromString = (string) => + gruvboxColors[ + Array.from(string) + .map((x) => x.charCodeAt(0)) + .reduce((a, x) => a + x, 0) % gruvboxColors.length + ]; |