Enum Colors

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Colors>

    public enum Colors
    extends java.lang.Enum<Colors>
    Provides an abstraction for printing with ANSI colors if it is supported.
    • Enum Constant Detail

      • BLACK

        public static final Colors BLACK
      • RED

        public static final Colors RED
      • BOLD_RED

        public static final Colors BOLD_RED
      • GREEN

        public static final Colors GREEN
      • BOLD_GREEN

        public static final Colors BOLD_GREEN
      • YELLOW

        public static final Colors YELLOW
      • BLUE

        public static final Colors BLUE
      • MAGENTA

        public static final Colors MAGENTA
      • CYAN

        public static final Colors CYAN
      • WHITE

        public static final Colors WHITE
      • BRIGHT_BLACK

        public static final Colors BRIGHT_BLACK
      • BRIGHT_RED

        public static final Colors BRIGHT_RED
      • BRIGHT_BOLD_RED

        public static final Colors BRIGHT_BOLD_RED
      • BRIGHT_GREEN

        public static final Colors BRIGHT_GREEN
      • BRIGHT_BOLD_GREEN

        public static final Colors BRIGHT_BOLD_GREEN
      • BRIGHT_YELLOW

        public static final Colors BRIGHT_YELLOW
      • BRIGHT_BOLD_YELLOW

        public static final Colors BRIGHT_BOLD_YELLOW
      • BRIGHT_BLUE

        public static final Colors BRIGHT_BLUE
      • BRIGHT_MAGENTA

        public static final Colors BRIGHT_MAGENTA
      • BRIGHT_CYAN

        public static final Colors BRIGHT_CYAN
      • BRIGHT_WHITE

        public static final Colors BRIGHT_WHITE
    • Method Detail

      • values

        public static Colors[] 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 (Colors c : Colors.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Colors valueOf​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • out

        public void out​(java.lang.String message)
        Prints to stdout using the Color if ANSI colors are enabled.
        Parameters:
        message - Message to print.
      • err

        public void err​(java.lang.String message)
        Prints to stderr using the Color if ANSI colors are enabled.
        Parameters:
        message - Message to print.
      • write

        public void write​(java.util.function.Consumer<java.lang.String> consumer,
                          java.lang.String message)
        Writes the color output to the given consumer.
        Parameters:
        consumer - Consume to invoke.
        message - Message to write.