Enum AnsiColorEscapeCodes

    • Method Detail

      • values

        public static AnsiColorEscapeCodes[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (AnsiColorEscapeCodes c : AnsiColorEscapeCodes.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static AnsiColorEscapeCodes valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getFgCode

        public int getFgCode​(boolean bright)
        Returns the foreground color code.
        Parameters:
        bright - true for bright color
        Returns:
        the foreground color code
      • getBgCode

        public int getBgCode​(boolean bright)
        Returns the background color code.
        Parameters:
        bright - true for bright color
        Returns:
        the background color code
      • formatAsAnsiColored

        public static String formatAsAnsiColored​(String s,
                                                 AnsiColorEscapeCodes colorFg,
                                                 AnsiColorEscapeCodes colorBg,
                                                 boolean bright)
        Returns a color formatted version of the provided string.
        Parameters:
        s - the provided string
        colorFg - the foreground color (null for no coloring)
        colorBg - the background color (null for no coloring)
        bright - true for bright color
        Returns:
        a color formatted version of the provided string (the empty string in case of a null value)