Skip to content

Instantly share code, notes, and snippets.

@ChrisMCMine
ChrisMCMine / ColorChanger4Minecraft.java
Created May 23, 2015 17:11
Convert a String with Minecraft color codes (http://minecraft.gamepedia.com/Formatting_codes) to its html representation using <font color=...
private ArrayList<Pair<Integer, Character>> getColorCodes() {
ArrayList<Pair<Integer, Character>> colorCodes = new ArrayList<>();
colorCodes.add(new Pair<>(0x000000, '0'));
colorCodes.add(new Pair<>(0x0000AA, '1'));
colorCodes.add(new Pair<>(0x00AA00, '2'));
colorCodes.add(new Pair<>(0x00AAAA, '3'));
colorCodes.add(new Pair<>(0xAA0000, '4'));
colorCodes.add(new Pair<>(0xAA00AA, '5'));
colorCodes.add(new Pair<>(0xFFAA00, '6'));