Skip to content

Instantly share code, notes, and snippets.

@hintss
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hintss/c77d5833ce5e0b5c28dd to your computer and use it in GitHub Desktop.
Save hintss/c77d5833ce5e0b5c28dd to your computer and use it in GitHub Desktop.
bukkit rainbows
String input = "blah";
StringBuilder output = new StringBuilder();
ChatColor[] colors = new ChatColor[] {ChatColor.RED, ChatColor.GOLD, ChatColor.YELLOW, ChatColor.GREEN, ChatColor.AQUA, ChatColor.LIGHT_PURPLE, ChatColor.DARK_PURPLE};
for (int i = 0; i < input.length(); i++) {
output.append(colors[i % colors.length]).append(input.substring(i, i + 1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment