Java Terminal Color Output colorText(final int color)

Here you can find the source of colorText(final int color)

Description

Color to text representation

License

Open Source License

Parameter

Parameter Description
color Color to convert

Return

Text representation

Declaration

public static String colorText(final int color) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from  ww  w . java  2s.  c o  m
     * Color to text representation
     * 
     * @param color
     *           Color to convert
     * @return Text representation
     */
    public static String colorText(final int color) {
        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);
    }
}

Related

  1. colorizeText(String str, String color)
  2. colorizeText(String str, String fgc, String bgc)
  3. colors(String string)
  4. colorString(String input)
  5. colorString(String string)
  6. colorText(int v, int vlo, int vhi, int rlo, int glo, int blo, int rhi, int ghi, int bhi)