Last active
August 20, 2017 19:43
-
-
Save kavdev/7ad219727dab50f2f136f49ad0393bdb to your computer and use it in GitHub Desktop.
User badge background color based on letter
This file contains 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
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] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Colors selected by @jacobjohannesen