Skip to content

Instantly share code, notes, and snippets.

@kavdev
Last active August 20, 2017 19:43
Show Gist options
  • Save kavdev/7ad219727dab50f2f136f49ad0393bdb to your computer and use it in GitHub Desktop.
Save kavdev/7ad219727dab50f2f136f49ad0393bdb to your computer and use it in GitHub Desktop.
User badge background color based on letter
badgeColors = [
"#f28920", "#49b75e", "#33ccb6", "#d13b7f", "#733aef", "#c8d60b", "#598ece", "#ea537a", "#dd9c4e",
"#6da877", "#b4f741", "#7775cc", "#8ca579", "#2c57f4", "#dd9c5b", "#e8e862", "#d11c4b", "#d3b34a",
"#4cd39f", "#599bfc", "#4eea95", "#ea47a8", "#c46f55", "#2588bf", "#6d6457", "#7e649e"
]
backgroundColor = badgeColors[("{{ user.last_name|index:0|title }}".charCodeAt() - 65) % 26]
@kavdev
Copy link
Author

kavdev commented Aug 20, 2017

Colors selected by @jacobjohannesen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment