Java Utililty Methods Terminal Color Output

List of utility methods to do Terminal Color Output

Description

The list of methods to do Terminal Color Output are organized into topic(s).

Method

StringcolorizeText(String str, String fgc, String bgc)
Creates a string with the given foreground and backgroundcolor.
return INTERNAL_MARKER + fgc + INTERNAL_MARKER + bgc.toLowerCase() + str + INTERNAL_MARKER + RESET_ALL;
Stringcolors(String string)
COLORIZE STRING
if (string == null)
    return null;
string = string.replaceAll("&([0-9a-fA-Fk-pK-PrR])", "\u00A7$1");
string = string.replaceAll("\u00A7P", "\u00A7p");
return string;
StringcolorString(String input)
color String
return input.replaceAll("&&", COLOR_CODE);
StringcolorString(String string)
color String
return colorString(string, '&');
StringcolorText(final int color)
Color to text representation
final char[] characters = new char[8];
for (int i = 0, shift = 28; i < 8; i++, shift -= 4) {
    characters[i] = Integer.toHexString((color >> shift) & 0xF).charAt(0);
return new String(characters);
StringcolorText(int v, int vlo, int vhi, int rlo, int glo, int blo, int rhi, int ghi, int bhi)
Color a text using BBCode such that the color either increase or decrease one value to other value for each component of the color A gradient would be produced from vlo to vhi, as v varies.
boolean rInc = true;
boolean gInc = true;
boolean bInc = true;
int rSmall = rlo;
int gSmall = glo;
int bSmall = blo;
if (rhi < rlo) {
    rInc = false;
...