Here you can find the source of colors(String string)
public static String colors(String string)
//package com.java2s; //License from project: Open Source License public class Main { /************************************************************************************************ * COLORIZE STRING/* w ww . ja v a 2 s. c o m*/ ***********************************************************************************************/ public static String colors(String string) { if (string == null) return null; string = string.replaceAll("&([0-9a-fA-Fk-pK-PrR])", "\u00A7$1"); string = string.replaceAll("\u00A7P", "\u00A7p"); return string; } }