Java Terminal Bold Output boldcolorizeText(String str, String fgc, String bgc)

Here you can find the source of boldcolorizeText(String str, String fgc, String bgc)

Description

Creates a string with the given high intensity foregroundcolor and the given backgroundcolor.

License

Open Source License

Parameter

Parameter Description
str String to be colorized.
fgc Constant defined color (see constants). Will be bold textcolor.
bgc Constant defined color (see constants). Will be backgroundcolor.

Return

String with internal markup-sequences.

Declaration

public static String boldcolorizeText(String str, String fgc, String bgc) 

Method Source Code

//package com.java2s;
//License/*from  www  . j  a  va 2  s .co  m*/

public class Main {
    /**
     * Defines the internal marker string
     * for style/color markups.
     */
    public static final String INTERNAL_MARKER = "\001";
    /**
     * Defines the markup representation of the activator
     * for style bold (normally represented by high intensity).
     */
    public static final String BOLD = "f";
    /**
     * Defines the markup representation of the graphics rendition
     * reset.<br>
     * It will reset all set colors and styles.
     */
    public static final String RESET_ALL = "a";

    /**
     * Creates a string with high intensity (bold) in the given textcolor.
     *
     * @param str   String to be boldcolorized.
     * @param color Constant defined color (see constants).
     * @return String with internal markup-sequences.
     */
    public static String boldcolorizeText(String str, String color) {
        return INTERNAL_MARKER + BOLD + INTERNAL_MARKER + color + str + INTERNAL_MARKER + RESET_ALL;
    }

    /**
     * Creates a string with the given high intensity foregroundcolor
     * and the given backgroundcolor.
     *
     * @param str String to be colorized.
     * @param fgc Constant defined color (see constants). Will be bold textcolor.
     * @param bgc Constant defined color (see constants). Will be backgroundcolor.
     * @return String with internal markup-sequences.
     */
    public static String boldcolorizeText(String str, String fgc, String bgc) {
        return INTERNAL_MARKER + BOLD + INTERNAL_MARKER + fgc + INTERNAL_MARKER + bgc.toLowerCase() + str
                + INTERNAL_MARKER + RESET_ALL;
    }
}

Related

  1. bold(String msg)
  2. bold(String str)
  3. boldcolorizeText(String str, String color)
  4. boldText(String str)