summaryrefslogtreecommitdiff
path: root/client/utils/generate_gruvbox.js
blob: 033d893a2f014cd3df3f230626593e14d01ce1e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
  ];